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.ObjectWrapperAndUnwrapper

`CANT_UNWRAP_TO_TARGET_CLASS`

### Fields inherited from interface freemarker.template.ObjectWrapper

`BEANS_WRAPPER, DEFAULT_WRAPPER, SIMPLE_WRAPPER`

### Constructor Summary

Constructors
Constructor and Description
`RhinoWrapper()`

### Method Summary

All Methods Instance Methods Concrete Methods
`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, 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`

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

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

### Constructor Detail

#### RhinoWrapper

    public RhinoWrapper()

### Method Detail

#### 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 generic `StringModel` 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`