|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object freemarker.ext.beans.ScalarModel
freemarker.ext.beans2
package
public class ScalarModel
A class that will wrap a reflected parameterless method call into a
TemplateScalarModel
interface. It can be used directly, and is
heavily used by ObjectModel
to wrap properties of primitive
types.
Constructor Summary | |
---|---|
ScalarModel(java.lang.Object object,
java.lang.reflect.Method getter)
Deprecated. Creates a new model. |
Method Summary | |
---|---|
java.lang.Object |
getAsObject()
Deprecated. Invokes the wrapped method, returns its return value. |
java.lang.String |
getAsString()
Deprecated. Calls the wrapped method, and calls toString() on its return value. |
boolean |
isEmpty()
Deprecated. Returns true only if the property value is a null, or a Boolean with false value. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public ScalarModel(java.lang.Object object, java.lang.reflect.Method getter)
object
- the object on which the method will be called.
Can be null
for static methods.getter
- the method that will be called to obtain
the value of the model.Method Detail |
---|
public java.lang.String getAsString() throws TemplateModelException
getAsString
in interface TemplateScalarModel
String
value of this scalar.
TemplateModelException
public java.lang.Object getAsObject() throws TemplateModelException
getAsObject
in interface TemplateObjectModel
TemplateModelException
- the object could not be returnedpublic boolean isEmpty() throws TemplateModelException
if
statements without testing for
obj == "true"
in the template.
isEmpty
in interface TemplateModel
true
if this object is empty, otherwise false
TemplateModelException
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |