|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--freemarker.ext.beans.ObjectModelBase
Base class for all classes that wrap objects into template models.
Instances of this class and descendant classes can be created directly,
or utilizing a model cache through getInstance()
calls, or
polymorphically through the BeansWrapper.wrap(Object)
method.
Field Summary | |
static int |
TYPE_ARRAY
Returned from getType() if the object is a ArrayModel |
static int |
TYPE_COLLECTION
Returned from getType() if the object is a CollectionModel |
static int |
TYPE_ENUMERATION
Returned from getType() if the object is a EnumerationModel |
static int |
TYPE_ITERATOR
Returned from getType() if the object is a IteratorModel |
static int |
TYPE_LIST
Returned from getType() if the object is a List |
static int |
TYPE_MAP
Returned from getType() if the object is a MapModel |
static int |
TYPE_OBJECT
Returned from getType() if the object is a ObjectModel |
static int |
TYPE_OBJECT_BASE
Returned from getType() if the object is a ObjectModelBase |
static int |
TYPE_RESOURCE_BUNDLE
Returned from getType() if the object is a ResourceBundleModel |
Method Summary | |
java.lang.Object |
getAsObject()
Returns the wrapped object. |
java.lang.String |
getAsString()
Returns either the toString() of the wrapped object or the string "null", if the wrapped object is null. |
static ObjectModelBase |
getInstance(java.lang.String object)
Returns a model wrapping the specified String object. |
int |
getType()
Returns the type of this object (which is TYPE_OBJECT_BASE) |
boolean |
isEmpty()
Tells whether the model is empty. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
public static final int TYPE_OBJECT_BASE
getType()
if the object is a ObjectModelBasepublic static final int TYPE_OBJECT
getType()
if the object is a ObjectModelpublic static final int TYPE_ARRAY
getType()
if the object is a ArrayModelpublic static final int TYPE_COLLECTION
getType()
if the object is a CollectionModelpublic static final int TYPE_MAP
getType()
if the object is a MapModelpublic static final int TYPE_ITERATOR
getType()
if the object is a IteratorModelpublic static final int TYPE_ENUMERATION
getType()
if the object is a EnumerationModelpublic static final int TYPE_RESOURCE_BUNDLE
getType()
if the object is a ResourceBundleModelpublic static final int TYPE_LIST
getType()
if the object is a ListMethod Detail |
public static final ObjectModelBase getInstance(java.lang.String object)
Returns a model wrapping the specified String object. If there is already
a cached model instance for this String, returns the cached model instance.
Models are cached using WeakReference
objects. The caching can be turned
off by setting the expose.reflection.nocache system property to
true. In this case calling this method is equivalent to constructing a new model.
Note that since the only FM-Classic-specific method in this class is
getAsString()
there is no sense in creating an object of this
class directly with anything except a String
. If you need to wrap an object
of another class, use one of specialized subclasses, or delegate the choice
to BeansWrapper.wrap(Object)
.
object
- the String to wrap into a model.public java.lang.Object getAsObject()
getAsObject
in interface TemplateObjectModel
freemarker.template.TemplateObjectModel
TemplateModelException
- the object could not be returnedpublic int getType()
public java.lang.String getAsString()
getAsString
in interface TemplateScalarModel
freemarker.template.TemplateScalarModel
String
value of this scalar.public boolean isEmpty()
isEmpty
in interface TemplateModel
freemarker.template.TemplateModel
true
if this object is empty, otherwise false
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |