freemarker.ext.beans2
Class StaticClassWrapper<T>
java.lang.Object
freemarker.ext.beans2.StaticClassWrapper<T>
- All Implemented Interfaces:
- TemplateHashModel, TemplateModel, TemplateScalarModel, TemplateWriteableHashModel, java.io.Serializable
- Direct Known Subclasses:
- StaticEnumWrapper
public class StaticClassWrapper<T>
- extends java.lang.Object
- implements TemplateHashModel, TemplateWriteableHashModel, TemplateScalarModel, java.io.Serializable
- Since:
- 1.9
- Version:
- $Id: StaticClassWrapper.java 1164 2005-10-09 11:57:04Z run2000 $
- Author:
- Nicholas Cull
- See Also:
- Serialized Form
Field Summary |
protected java.lang.Class<T> |
clazz
|
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
clazz
protected java.lang.Class<T> clazz
StaticClassWrapper
public StaticClassWrapper()
StaticClassWrapper
public StaticClassWrapper(java.lang.Class<T> clazz)
getClazz
public java.lang.Class getClazz()
setClazz
public void setClazz(java.lang.Class<T> clazz)
isEmpty
public boolean isEmpty()
throws TemplateModelException
- Is the object empty?
- Specified by:
isEmpty
in interface TemplateModel
- Returns:
true
if this object is empty, otherwise false
- Throws:
TemplateModelException
get
public TemplateModel get(java.lang.String key)
throws TemplateModelException
- Gets a
TemplateModel
from the hash.
- Specified by:
get
in interface TemplateHashModel
- Parameters:
key
- the name by which the TemplateModel
is identified in the template.
- Returns:
- the
TemplateModel
referred to by the key,
or null
if not found.
- Throws:
TemplateModelException
- there was a problem getting the value
for the given key
put
public void put(java.lang.String key,
TemplateModel model)
throws TemplateModelException
- Sets a value in the hash model.
- Specified by:
put
in interface TemplateWriteableHashModel
- Parameters:
key
- the hash keymodel
- the value to be added to the hash model
- Throws:
TemplateModelException
- there was a problem setting the value
for the given key
getAsString
public java.lang.String getAsString()
throws TemplateModelException
- Returns the class's name as a
String
.
- Specified by:
getAsString
in interface TemplateScalarModel
- Returns:
- the
String
representation of this class.
- Throws:
TemplateModelException