Package freemarker.ext.beans
Class StringModel
- java.lang.Object
-
- freemarker.ext.beans.BeanModel
-
- freemarker.ext.beans.StringModel
-
- All Implemented Interfaces:
WrapperTemplateModel,AdapterTemplateModel,TemplateHashModel,TemplateHashModelEx,TemplateModel,TemplateModelWithAPISupport,TemplateScalarModel
- Direct Known Subclasses:
CollectionModel,MapModel
public class StringModel extends BeanModel implements TemplateScalarModel
Subclass ofBeanModelthat exposes the return value of theObject.toString()method through theTemplateScalarModelinterface.
-
-
Field Summary
-
Fields inherited from interface freemarker.template.TemplateModel
NOTHING
-
Fields inherited from interface freemarker.template.TemplateScalarModel
EMPTY_STRING
-
-
Constructor Summary
Constructors Constructor Description StringModel(java.lang.Object object, BeansWrapper wrapper)Creates a new model that wraps the specified object with BeanModel + scalar functionality.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.StringgetAsString()Returns the result of callingObject.toString()on the wrapped object.-
Methods inherited from class freemarker.ext.beans.BeanModel
get, getAdaptedObject, getAPI, getWrappedObject, hasPlainGetMethod, invokeGenericGet, isEmpty, keys, keySet, size, toString, unwrap, values, wrap
-
-
-
-
Constructor Detail
-
StringModel
public StringModel(java.lang.Object object, BeansWrapper wrapper)Creates a new model that wraps the specified object with BeanModel + scalar functionality.- Parameters:
object- the object to wrap into a model.wrapper- theBeansWrapperassociated with this model. Every model has to have an associatedBeansWrapperinstance. The model gains many attributes from its wrapper, including the caching behavior, method exposure level, method-over-item shadowing policy etc.
-
-
Method Detail
-
getAsString
public java.lang.String getAsString()
Returns the result of callingObject.toString()on the wrapped object.- Specified by:
getAsStringin interfaceTemplateScalarModel
-
-