|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object freemarker.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 wrappedMethod Detail |
---|
public void setObject(java.lang.Object object)
ObjectWrapper
setObject
in interface ObjectWrapper
object
- the object to be wrappedpublic boolean isEmpty() throws TemplateModelException
TemplateModel
isEmpty
in interface TemplateModel
true
if this object is empty, otherwise false
TemplateModelException
public TemplateModel get(java.lang.String key) throws TemplateModelException
TemplateHashModel
TemplateModel
from the hash.
get
in interface TemplateHashModel
key
- 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 keypublic void put(java.lang.String key, TemplateModel model) throws TemplateModelException
put
in interface TemplateWriteableHashModel
key
- the hash keymodel
- the value to be added to the hash model
TemplateModelException
- there was a problem setting the value
for the given keypublic java.lang.Object getAsObject() throws TemplateModelException
getAsObject
in interface TemplateObjectModel
TemplateModelException
- the object could not be returnedpublic java.lang.String getAsString() throws TemplateModelException
String
using the object's
toString method.
getAsString
in interface TemplateScalarModel
String
value of this object.
TemplateModelException
public java.lang.Object clone()
clone
in interface ObjectWrapper
clone
in class java.lang.Object
java.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 |