RhinoWrapper (FreeMarker 2.3.35 API)
Description: declaration: package: freemarker.ext.rhino, class: RhinoWrapper

Package freemarker.ext.rhino

# Class RhinoWrapper

java.lang.Object
freemarker.ext.beans.BeansWrapper
freemarker.ext.rhino.RhinoWrapper

All Implemented Interfaces:
  `ObjectWrapper`, `ObjectWrapperAndUnwrapper`, `ObjectWrapperWithAPISupport`, `RichObjectWrapper`, `WriteProtectable`

public class RhinoWrapper extends BeansWrapper

- ## 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

  Constructors
  Constructor
  Description
  `RhinoWrapper()`

- ## Method Summary

  Modifier and Type
  Method
  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.

  ### 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, getOuterIdentity, getPreferIndexedReadMethod, getRecordZeroArgumentNonVoidMethodPolicy, getStaticModels, getTreatDefaultMethodsAsBeanMembers, getUseCache, invokeMethod, isClassIntrospectionCacheRestricted, isExposeFields, isSimpleMapWrapper, isStrict, isWriteProtected, newInstance, normalizeIncompatibleImprovementsVersion, readField, removeFromClassIntrospectionCache, setDefaultDateType, setDefaultZeroArgumentNonVoidMethodPolicy, setExposeFields, setExposureLevel, setMemberAccessPolicy, setMethodAppearanceFineTuner, setMethodsShadowItems, setNullModel, setOuterIdentity, setPreferIndexedReadMethod, setRecordZeroArgumentNonVoidMethodPolicy, setSimpleMapWrapper, setStrict, setTreatDefaultMethodsAsBeanMembers, setUseCache, toPropertiesString, toString, tryUnwrapTo, unwrap, unwrap, wrap, wrapAsAPI, writeProtect`

  ### Methods inherited from class java.lang.Object

  `clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

- ## Constructor Details

  - ### RhinoWrapper

    public RhinoWrapper()

- ## Method Details

  - ### wrap

    public TemplateModel wrap​(Object obj) throws TemplateModelException
    Description copied from class: `BeansWrapper`
    Wraps the object with a template model that is most specific for the object's class. Specifically:
    - if the object is null, returns the `null model`,
    - if the object is a Number returns a `NumberModel` for it,
    - if the object is a Date returns a `DateModel` for it,
    - if the object is a Boolean returns `TemplateBooleanModel.TRUE` or `TemplateBooleanModel.FALSE`
    - if the object is already a TemplateModel, returns it unchanged,
    - if the object is an array, returns a `ArrayModel` for it
    - if the object is a Map, returns a `MapModel` for it
    - if the object is a Collection, returns a `CollectionModel` for it
    - if the object is an Iterator, returns a `IteratorModel` for it
    - if the object is an Enumeration, returns a `EnumerationModel` for it
    - if the object is a String, returns a `StringModel` for it
    - otherwise, returns a `GenericObjectModel` for it.
    Specified by:
      `wrap` in interface `ObjectWrapper`
    Overrides:
      `wrap` in class `BeansWrapper`
    Parameters:
      `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).
    Returns:
      a `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)`).
    Throws:
      `TemplateModelException`

  - ### getModelFactory

    protected ModelFactory getModelFactory​(Class clazz)
    Overrides:
      `getModelFactory` in class `BeansWrapper`