freemarker.ext.beans
Class BeansWrapper

java.lang.Object
  |
  +--freemarker.ext.beans.BeansWrapper

public final class BeansWrapper
extends java.lang.Object

Utility class that provides generic services to reflection classes. It handles all polymorphism issues in the wrap(Object) and unwrap(Object) methods.

Version:
1.0
Author:
Attila Szegedi, szegedia@freemail.hu

Method Summary
static java.lang.Object unwrap(java.lang.Object model)
          Attempts to unwrap a model into underlying object.
static TemplateModel wrap(java.lang.Object object)
          Wraps the object with a template model that is most specific for the object's class.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

wrap

public static final TemplateModel wrap(java.lang.Object object)
Wraps the object with a template model that is most specific for the object's class. Specifically:

unwrap

public static final java.lang.Object unwrap(java.lang.Object model)
                                     throws TemplateModelException
Attempts to unwrap a model into underlying object. It can unwrap BeanModelBase instances, as well as generic TemplateNumberModel and TemplateScalarModel instances. All other objects are returned unchanged.