public class RhinoWrapper extends BeansWrapper
BeansWrapper.MethodAppearanceDecision, BeansWrapper.MethodAppearanceDecisionInput
EXPOSE_ALL, EXPOSE_NOTHING, EXPOSE_PROPERTIES_ONLY, EXPOSE_SAFE
CANT_UNWRAP_TO_TARGET_CLASS
BEANS_WRAPPER, DEFAULT_WRAPPER, SIMPLE_WRAPPER
Constructor and Description |
---|
RhinoWrapper() |
Modifier and Type | Method and Description |
---|---|
protected ModelFactory |
getModelFactory(Class clazz) |
TemplateModel |
wrap(Object obj)
Wraps the object with a template model that is most specific for the object's
class.
|
checkModifiable, clearClassIntrospecitonCache, coerceBigDecimal, coerceBigDecimals, coerceBigDecimals, finalizeConstruction, finetuneMethodAppearance, getDefaultDateType, getDefaultInstance, getEnumModels, getExposureLevel, getIncompatibleImprovements, getInstance, getMethodAppearanceFineTuner, getOuterIdentity, getStaticModels, getUseCache, isClassIntrospectionCacheRestricted, isExposeFields, isSimpleMapWrapper, isStrict, isWriteProtected, newInstance, normalizeIncompatibleImprovementsVersion, removeFromClassIntrospectionCache, setDefaultDateType, setExposeFields, setExposureLevel, setMethodAppearanceFineTuner, setMethodsShadowItems, setNullModel, setOuterIdentity, setSimpleMapWrapper, setStrict, setUseCache, toPropertiesString, toString, tryUnwrapTo, unwrap, unwrap, wrap, wrapAsAPI, writeProtect
public TemplateModel wrap(Object obj) throws TemplateModelException
BeansWrapper
null model
,NumberModel
for it,DateModel
for it,TemplateBooleanModel.TRUE
or
TemplateBooleanModel.FALSE
ArrayModel
for it
MapModel
for it
CollectionModel
for it
IteratorModel
for it
EnumerationModel
for it
StringModel
for it
StringModel
for it.
wrap
in interface ObjectWrapper
wrap
in class BeansWrapper
obj
- The object to wrap into a TemplateModel
. If it already implements TemplateModel
,
it should just return the object as is. If it's null
, the method should return null
(however, BeansWrapper
, has a legacy option for returning a null model object instead, but it's not
a good idea).TemplateModel
wrapper of the object passed in. To support un-wrapping, you may consider the
return value to implement WrapperTemplateModel
and AdapterTemplateModel
.
The default expectation is that the TemplateModel
isn't less thread safe than the wrapped object.
If the ObjectWrapper
returns less thread safe objects, that should be clearly documented, as it
restricts how it can be used, like, then it can't be used to wrap "shared variables"
(Configuration.setSharedVaribles(Map)
).TemplateModelException
protected ModelFactory getModelFactory(Class clazz)
getModelFactory
in class BeansWrapper