Package freemarker.template
Class SimpleObjectWrapper
java.lang.Object
freemarker.ext.beans.BeansWrapper
freemarker.template.DefaultObjectWrapper
freemarker.template.SimpleObjectWrapper
- All Implemented Interfaces:
ObjectWrapper
,ObjectWrapperAndUnwrapper
,ObjectWrapperWithAPISupport
,RichObjectWrapper
,WriteProtectable
A restricted object wrapper that will not expose arbitrary object, just those that directly correspond to the
TemplateModel
sub-interfaces (String
, Map
and such). If it had to wrap other kind of objects,
it will throw exception. It will also block ?api
calls on the values it wraps.-
Nested Class Summary
Nested classes/interfaces inherited from class freemarker.ext.beans.BeansWrapper
BeansWrapper.MethodAppearanceDecision, BeansWrapper.MethodAppearanceDecisionInput
-
Field Summary
Fields inherited from class freemarker.ext.beans.BeansWrapper
EXPOSE_ALL, EXPOSE_NOTHING, EXPOSE_PROPERTIES_ONLY, EXPOSE_SAFE
Fields inherited from interface freemarker.template.ObjectWrapper
BEANS_WRAPPER, DEFAULT_WRAPPER, SIMPLE_WRAPPER
Fields inherited from interface freemarker.template.ObjectWrapperAndUnwrapper
CANT_UNWRAP_TO_TARGET_CLASS
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionprotected TemplateModel
handleUnknownType(Object obj)
Called if a type other than the simple ones we know about is passed in.Wraps an object to aTemplateModel
that exposes the object's "native" (usually, Java) API.Methods inherited from class freemarker.template.DefaultObjectWrapper
convertArray, getDOMNodeSupport, getForceLegacyNonListCollections, getIterableSupport, getJythonSupport, getUseAdaptersForContainers, normalizeIncompatibleImprovementsVersion, setDOMNodeSupport, setForceLegacyNonListCollections, setIterableSupport, setJythonSupport, setUseAdaptersForContainers, toPropertiesString, wrap, wrapDomNode
Methods inherited from class freemarker.ext.beans.BeansWrapper
checkModifiable, clearClassIntrospecitonCache, clearClassIntrospectionCache, coerceBigDecimal, coerceBigDecimals, coerceBigDecimals, finalizeConstruction, finetuneMethodAppearance, getDefaultDateType, getDefaultInstance, getDefaultZeroArgumentNonVoidMethodPolicy, getEnumModels, getExposureLevel, getIncompatibleImprovements, getInstance, getMemberAccessPolicy, getMethodAppearanceFineTuner, getModelFactory, getOuterIdentity, getPreferIndexedReadMethod, getRecordZeroArgumentNonVoidMethodPolicy, getStaticModels, getTreatDefaultMethodsAsBeanMembers, getUseCache, invokeMethod, isClassIntrospectionCacheRestricted, isExposeFields, isSimpleMapWrapper, isStrict, isWriteProtected, newInstance, readField, removeFromClassIntrospectionCache, setDefaultDateType, setDefaultZeroArgumentNonVoidMethodPolicy, setExposeFields, setExposureLevel, setMemberAccessPolicy, setMethodAppearanceFineTuner, setMethodsShadowItems, setNullModel, setOuterIdentity, setPreferIndexedReadMethod, setRecordZeroArgumentNonVoidMethodPolicy, setSimpleMapWrapper, setStrict, setTreatDefaultMethodsAsBeanMembers, setUseCache, toString, tryUnwrapTo, unwrap, unwrap, wrap, writeProtect
-
Constructor Details
-
SimpleObjectWrapper
Deprecated.UseSimpleObjectWrapper(Version)
instead. -
SimpleObjectWrapper
- Parameters:
incompatibleImprovements
- see inBeansWrapper(Version)
.- Since:
- 2.3.21
-
-
Method Details
-
handleUnknownType
Called if a type other than the simple ones we know about is passed in. In this implementation, this just throws an exception.- Overrides:
handleUnknownType
in classDefaultObjectWrapper
- Throws:
TemplateModelException
-
wrapAsAPI
Description copied from interface:ObjectWrapperWithAPISupport
Wraps an object to aTemplateModel
that exposes the object's "native" (usually, Java) API.- Specified by:
wrapAsAPI
in interfaceObjectWrapperWithAPISupport
- Overrides:
wrapAsAPI
in classBeansWrapper
- Parameters:
obj
- The object for which the API model has to be returned. Shouldn't benull
.- Returns:
- The
TemplateModel
through which the API of the object can be accessed. Can't benull
. - Throws:
TemplateModelException
-
SimpleObjectWrapper(Version)
instead.