|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectfreemarker.ext.beans2.BeanWrapper<T>
public class BeanWrapper<T>
Wrapper for a JavaBean or a Plain Old Java Object. Provides access to fields, properties and methods of the object. Also a base class for other Wrapper objects.
| Field Summary | |
|---|---|
protected static java.lang.Object[] |
emptyParams
For the benefit of property read methods, pre-construct an array of zero argument to pass to the method |
protected T |
object
The object being wrapped by this wrapper |
| Constructor Summary | |
|---|---|
BeanWrapper()
Default constructor where an object is not provided initially. |
|
BeanWrapper(T object)
Constructor that takes a POJO or JavaBean object to be wrapped. |
|
| Method Summary | |
|---|---|
java.lang.Object |
clone()
Creates and returns a copy of this object. |
TemplateModel |
get(java.lang.String key)
Gets a TemplateModel from the hash. |
java.lang.Object |
getAsObject()
Return the underlying object to the reflection mechanism. |
java.lang.String |
getAsString()
Returns the bean's value as a String using the object's
toString method. |
boolean |
isEmpty()
Is the object empty? |
void |
put(java.lang.String key,
TemplateModel model)
Sets a value in the hash model. |
void |
setObject(java.lang.Object object)
Sets the object to be wrapped by this object wrapper. |
| Methods inherited from class java.lang.Object |
|---|
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected T object
protected static final java.lang.Object[] emptyParams
| Constructor Detail |
|---|
public BeanWrapper()
public BeanWrapper(T object)
object - the object to be wrapped| Method Detail |
|---|
public void setObject(java.lang.Object object)
ObjectWrapper
setObject in interface ObjectWrapperobject - the object to be wrapped
public boolean isEmpty()
throws TemplateModelException
TemplateModel
isEmpty in interface TemplateModeltrue if this object is empty, otherwise false
TemplateModelException
public TemplateModel get(java.lang.String key)
throws TemplateModelException
TemplateHashModelTemplateModel from the hash.
get in interface TemplateHashModelkey - the name by which the TemplateModel
is identified in the template.
TemplateModel referred to by the key,
or null if not found.
TemplateModelException - there was a problem getting the value
for the given key
public void put(java.lang.String key,
TemplateModel model)
throws TemplateModelException
put in interface TemplateWriteableHashModelkey - the hash keymodel - the value to be added to the hash model
TemplateModelException - there was a problem setting the value
for the given key
public java.lang.Object getAsObject()
throws TemplateModelException
getAsObject in interface TemplateObjectModelTemplateModelException - the object could not be returned
public java.lang.String getAsString()
throws TemplateModelException
String using the object's
toString method.
getAsString in interface TemplateScalarModelString value of this object.
TemplateModelExceptionpublic java.lang.Object clone()
clone in interface ObjectWrapperclone in class java.lang.Objectjava.lang.RuntimeException - the clone operation was not successful
java.lang.OutOfMemoryError - if there is not enough memory.Cloneable
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||