public class DeepUnwrap
extends java.lang.Object
TemplateModel-s.| Constructor and Description |
|---|
DeepUnwrap() |
| Modifier and Type | Method and Description |
|---|---|
static java.lang.Object |
permissiveUnwrap(TemplateModel model)
Same as
unwrap(TemplateModel), but it doesn't throw exception
if it doesn't know how to unwrap the model, but rather returns it as-is. |
static java.lang.Object |
premissiveUnwrap(TemplateModel model)
Deprecated.
the name of this method is mistyped. Use
permissiveUnwrap(TemplateModel) instead. |
static java.lang.Object |
unwrap(TemplateModel model)
Unwraps
TemplateModel-s recursively. |
public static java.lang.Object unwrap(TemplateModel model) throws TemplateModelException
TemplateModel-s recursively.
The converting of the TemplateModel object happens with the following rules:
AdapterTemplateModel, then the result
of AdapterTemplateModel.getAdaptedObject(Class) for Object.class is returned.
WrapperTemplateModel, then the result
of WrapperTemplateModel.getWrappedObject() is returned.
TemplateScalarModel, then the result
of TemplateScalarModel.getAsString() is returned.
TemplateNumberModel, then the result
of TemplateNumberModel.getAsNumber() is returned.
TemplateDateModel, then the result
of TemplateDateModel.getAsDate() is returned.
TemplateBooleanModel, then the result
of TemplateBooleanModel.getAsBoolean() is returned.
TemplateSequenceModel or
TemplateCollectionModel, then a java.util.ArrayList is
constructed from the subvariables, and each subvariable is unwrapped with
the rules described here (recursive unwrapping).
TemplateHashModelEx, then a
java.util.HashMap is constructed from the subvariables, and each
subvariable is unwrapped with the rules described here (recursive unwrapping).
TemplateModelException, because it doesn't know how to
unwrap the object.
TemplateModelExceptionpublic static java.lang.Object permissiveUnwrap(TemplateModel model) throws TemplateModelException
unwrap(TemplateModel), but it doesn't throw exception
if it doesn't know how to unwrap the model, but rather returns it as-is.TemplateModelException@Deprecated public static java.lang.Object premissiveUnwrap(TemplateModel model) throws TemplateModelException
permissiveUnwrap(TemplateModel) instead.TemplateModelException