freemarker.ext.beans

Class StringModel

Implemented Interfaces:
AdapterTemplateModel, TemplateHashModel, TemplateHashModelEx, TemplateModel, TemplateScalarModel, WrapperTemplateModel
Known Direct Subclasses:
CollectionModel, MapModel

public class StringModel
extends BeanModel
implements TemplateScalarModel

Subclass of BeanModel that exposes the return value of the java.lang.Object.toString() method through the TemplateScalarModel interface.
Version:
$Id: StringModel.java,v 1.9 2003/06/03 13:21:33 szegedia Exp $
Author:
Attila Szegedi

Field Summary

Fields inherited from class freemarker.ext.beans.BeanModel

object, wrapper

Fields inherited from interface freemarker.template.TemplateModel

NOTHING

Fields inherited from interface freemarker.template.TemplateScalarModel

EMPTY_STRING

Constructor Summary

StringModel(Object object, BeansWrapper wrapper)
Creates a new model that wraps the specified object with BeanModel + scalar functionality.

Method Summary

String
getAsString()
Returns the result of calling Object.toString() on the wrapped object.

Methods inherited from class freemarker.ext.beans.BeanModel

get, getAdaptedObject, getWrappedObject, hasPlainGetMethod, invokeGenericGet, isEmpty, keySet, keys, size, toString, unwrap, values, wrap

Constructor Details

StringModel

public StringModel(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 - the BeansWrapper associated with this model. Every model has to have an associated BeansWrapper instance. The model gains many attributes from its wrapper, including the caching behavior, method exposure level, method-over-item shadowing policy etc.

Method Details

getAsString

public String getAsString()
Returns the result of calling Object.toString() on the wrapped object.
Specified by:
getAsString in interface TemplateScalarModel