Package freemarker.ext.beans
Class NumberModel
java.lang.Object
freemarker.ext.beans.BeanModel
freemarker.ext.beans.NumberModel
- All Implemented Interfaces:
WrapperTemplateModel,AdapterTemplateModel,TemplateHashModel,TemplateHashModelEx,TemplateModel,TemplateModelWithAPISupport,TemplateNumberModel
Wraps arbitrary subclass of
Number into a reflective model.
Beside acting as a TemplateNumberModel, you can call all Java methods on
these objects as well.-
Field Summary
Fields inherited from interface freemarker.template.TemplateModel
NOTHING -
Constructor Summary
ConstructorsConstructorDescriptionNumberModel(Number number, BeansWrapper wrapper)Creates a new model that wraps the specified number object. -
Method Summary
Methods inherited from class freemarker.ext.beans.BeanModel
get, get, getAdaptedObject, getAPI, getBeforeMethodCall, getWrappedObject, hasPlainGetMethod, invokeGenericGet, isEmpty, keys, keySet, size, toString, unwrap, values, wrap
-
Constructor Details
-
NumberModel
Creates a new model that wraps the specified number object.- Parameters:
number- the number 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 Details
-
getAsNumber
Description copied from interface:TemplateNumberModelReturns the numeric value. The return value must not benull.- Specified by:
getAsNumberin interfaceTemplateNumberModel- Returns:
- the
Numberinstance associated with this number model.
-