Package freemarker.template
Interface ObjectWrapper
-
- All Known Implementing Classes:
freemarker.ext.beans.BeansWrapper,DefaultObjectWrapper,SimpleObjectWrapper
public interface ObjectWrapperAn object that knows how to "wrap" a java object as a TemplateModel instance.
-
-
Field Summary
Fields Modifier and Type Field Description static ObjectWrapperBEANS_WRAPPERAn ObjectWrapper that works similarly toSIMPLE_WRAPPER, but exposes the objects methods and JavaBeans properties as hash elements and custom handling for Java Maps, ResourceBundles, etc.static ObjectWrapperDEFAULT_WRAPPERThe default object wrapper implementation.static ObjectWrapperSIMPLE_WRAPPERObject wrapper that uses SimpleXXX wrappers only.
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description TemplateModelwrap(Object obj)
-
-
-
Field Detail
-
BEANS_WRAPPER
static final ObjectWrapper BEANS_WRAPPER
An ObjectWrapper that works similarly toSIMPLE_WRAPPER, but exposes the objects methods and JavaBeans properties as hash elements and custom handling for Java Maps, ResourceBundles, etc.
-
DEFAULT_WRAPPER
static final ObjectWrapper DEFAULT_WRAPPER
The default object wrapper implementation. Wraps Maps as SimpleHash and Lists as SimpleSequences, Strings and Numbers as SimpleScalar and SimpleNumber respectively. Other objects are beans-wrapped, thus exposing reflection-based information.
-
SIMPLE_WRAPPER
static final ObjectWrapper SIMPLE_WRAPPER
Object wrapper that uses SimpleXXX wrappers only. This wrapper has far more restrictive semantics. It behaves like the DEFAULT_WRAPPER, but for objects that it does not know how to wrap as a SimpleXXX, it throws an exception. It makes no use of reflection-based exposure of methods.
-
-
Method Detail
-
wrap
TemplateModel wrap(Object obj) throws TemplateModelException
- Returns:
- a TemplateModel wrapper of the object passed in.
- Throws:
TemplateModelException
-
-