|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectfreemarker.ext.rhino.RhinoScriptableModel
public class RhinoScriptableModel
Experimental: no backward compatibility guarantees; any feedback is highly welcome!
| Field Summary |
|---|
| Fields inherited from interface freemarker.template.TemplateModel |
|---|
NOTHING |
| Fields inherited from interface freemarker.template.TemplateScalarModel |
|---|
EMPTY_STRING |
| Fields inherited from interface freemarker.template.TemplateBooleanModel |
|---|
FALSE, TRUE |
| Constructor Summary | |
|---|---|
RhinoScriptableModel(org.mozilla.javascript.Scriptable scriptable,
BeansWrapper wrapper)
|
|
| Method Summary | |
|---|---|
TemplateModel |
get(int index)
Retrieves the i-th template model in this sequence. |
TemplateModel |
get(java.lang.String key)
Gets a TemplateModel from the hash. |
java.lang.Object |
getAdaptedObject(java.lang.Class hint)
Retrieves the underlying object, or some other object semantically equivalent to its value narrowed by the class hint. |
boolean |
getAsBoolean()
|
java.lang.Number |
getAsNumber()
Returns the numeric value. |
java.lang.String |
getAsString()
Returns the string representation of this model. |
boolean |
isEmpty()
|
TemplateCollectionModel |
keys()
|
int |
size()
|
TemplateCollectionModel |
values()
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public RhinoScriptableModel(org.mozilla.javascript.Scriptable scriptable,
BeansWrapper wrapper)
| Method Detail |
|---|
public TemplateModel get(java.lang.String key)
throws TemplateModelException
TemplateHashModel
get in interface TemplateHashModelkey - the name by which the TemplateModel
is identified in the template.
TemplateModelException
public TemplateModel get(int index)
throws TemplateModelException
TemplateSequenceModel
get in interface TemplateSequenceModelnull if
the index is out of bounds. Note that a null value is
interpreted by FreeMarker as "variable does not exist", and accessing
a missing variables is usually considered as an error in the FreeMarker
Template Language, so the usage of a bad index will not remain hidden.
TemplateModelExceptionpublic boolean isEmpty()
isEmpty in interface TemplateHashModel
public TemplateCollectionModel keys()
throws TemplateModelException
keys in interface TemplateHashModelExTemplateScalarModel
(as the keys of hashes are always strings).
TemplateModelExceptionpublic int size()
size in interface TemplateHashModelExsize in interface TemplateSequenceModel
public TemplateCollectionModel values()
throws TemplateModelException
values in interface TemplateHashModelExTemplateModelExceptionpublic boolean getAsBoolean()
getAsBoolean in interface TemplateBooleanModelpublic java.lang.Number getAsNumber()
TemplateNumberModel
getAsNumber in interface TemplateNumberModelNumber instance associated with this number model.public java.lang.String getAsString()
TemplateScalarModel
getAsString in interface TemplateScalarModelpublic java.lang.Object getAdaptedObject(java.lang.Class hint)
AdapterTemplateModel
getAdaptedObject in interface AdapterTemplateModelhint - the desired class of the returned value. An implementation
should make reasonable effort to retrieve an object of the requested
class, but if that is impossible, it must at least return the underlying
object as-is. As a minimal requirement, an implementation must always
return the exact underlying object when
hint.isInstance(underlyingObject) == true holds. When called
with java.lang.Object.class, it should return a generic Java
object (i.e. if the model is wrapping a scripting lanugage object that is
further wrapping a Java object, the deepest underlying Java object should
be returned).
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||