freemarker.ext.beans
Class ObjectModelBase

java.lang.Object
  extended by freemarker.ext.beans.ObjectModelBase
All Implemented Interfaces:
TemplateModel, TemplateObjectModel, TemplateScalarModel, java.io.Serializable
Direct Known Subclasses:
ArrayModel, ObjectModel, ResourceBundleModel

Deprecated. this class is deprecated in favour of the classes in the freemarker.ext.beans2 package

public class ObjectModelBase
extends java.lang.Object
implements TemplateScalarModel, TemplateObjectModel, java.io.Serializable

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.

Version:
$Id: ObjectModelBase.java 1101 2013-04-01 04:17:32Z run2000 $
Author:
Attila Szegedi, attila@szegedi.org
See Also:
Serialized Form

Field Summary
protected  java.lang.Object object
          Deprecated.  
 
Method Summary
 java.lang.Object getAsObject()
          Deprecated. Returns the wrapped object.
 java.lang.String getAsString()
          Deprecated. 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)
          Deprecated. Returns a model wrapping the specified String object.
 freemarker.ext.beans.ObjectModelBase.ModelType getType()
          Deprecated. Returns the type of this object (which is TYPE_OBJECT_BASE)
 boolean isEmpty()
          Deprecated. 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

object

protected java.lang.Object object
Deprecated. 
Method Detail

getInstance

public static final ObjectModelBase getInstance(java.lang.String object)
Deprecated. 

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).

Parameters:
object - the String to wrap into a model.
Returns:
the model for the String

getAsObject

public java.lang.Object getAsObject()
Deprecated. 
Returns the wrapped object.

Specified by:
getAsObject in interface TemplateObjectModel
Returns:
the underlying object for this template model

getType

public freemarker.ext.beans.ObjectModelBase.ModelType getType()
Deprecated. 
Returns the type of this object (which is TYPE_OBJECT_BASE)


getAsString

public java.lang.String getAsString()
Deprecated. 
Returns either the toString() of the wrapped object or the string "null", if the wrapped object is null.

Specified by:
getAsString in interface TemplateScalarModel
Returns:
the String value of this scalar.

isEmpty

public boolean isEmpty()
Deprecated. 
Tells whether the model is empty. It is empty if either the wrapped object is null, or it is a Boolean with false value.

Specified by:
isEmpty in interface TemplateModel
Returns:
true if this object is empty, otherwise false