freemarker.ext.beans2
Class Wrapper

java.lang.Object
  extended by freemarker.ext.beans2.Wrapper

public class Wrapper
extends java.lang.Object

Wraps a given object, class or enum in a FM-Classic template model. An appropriate model will be determined and returned based on introspection of the supplied object or class.

Since:
1.9
Version:
$Id: Wrapper.java 1067 2011-06-06 10:55:28Z run2000 $
Author:
Nicholas Cull

Method Summary
static
<T> TemplateModel
wrap(java.lang.Class<T> clazz)
          Wraps the given class or enum in a FM-Classic template model using reflection.
static TemplateModel wrap(java.lang.Object object)
          Wrap the given object in a FM-Classic template model using reflection.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

wrap

public static TemplateModel wrap(java.lang.Object object)
                          throws java.lang.ClassCastException,
                                 java.lang.NullPointerException
Wrap the given object in a FM-Classic template model using reflection. Methods, fields, and properties are available to the template engine using standard template model implementations.

Parameters:
object - the object to be wrapped in a template model
Returns:
a FM-Classic template model providing an interface to the underlying object
Throws:
java.lang.ClassCastException
java.lang.NullPointerException

wrap

public static <T> TemplateModel wrap(java.lang.Class<T> clazz)
Wraps the given class or enum in a FM-Classic template model using reflection. Static methods and fields are available to the template engine using standard template model implementations.

Parameters:
clazz - the class to be wrapped in a template model
Returns:
a FM-Classic template model providing an interface to the underlying class