|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectfreemarker.ext.beans.BeanModel
freemarker.ext.beans.ArrayModel
public class ArrayModel
A class that will wrap an arbitrary array into TemplateCollectionModel
and TemplateSequenceModel interfaces. It supports element retrieval through the array[index]
syntax and can be iterated as a list.
| Field Summary |
|---|
| Fields inherited from class freemarker.ext.beans.BeanModel |
|---|
object, wrapper |
| Fields inherited from interface freemarker.template.TemplateModel |
|---|
NOTHING |
| Constructor Summary | |
|---|---|
ArrayModel(java.lang.Object array,
BeansWrapper wrapper)
Creates a new model that wraps the specified array object. |
|
| Method Summary | |
|---|---|
TemplateModel |
get(int index)
Retrieves the i-th template model in this sequence. |
boolean |
isEmpty()
Tells whether the model is empty. |
TemplateModelIterator |
iterator()
Retrieves a template model iterator that is used to iterate over the elements in this collection. |
int |
size()
|
| Methods inherited from class freemarker.ext.beans.BeanModel |
|---|
get, getAdaptedObject, getWrappedObject, hasPlainGetMethod, invokeGenericGet, keys, keySet, toString, unwrap, values, wrap |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
|---|
public ArrayModel(java.lang.Object array,
BeansWrapper wrapper)
array - the array object to wrap into a model.wrapper - the BeansWrapper associated with this model.
Every model has to have an associated BeansWrapper instance. The
model gains many attributes from its wrapper, including the caching
behavior, method exposure level, method-over-item shadowing policy etc.
java.lang.IllegalArgumentException - if the passed object is not a Java array.| Method Detail |
|---|
public TemplateModelIterator iterator()
TemplateCollectionModel
iterator in interface TemplateCollectionModel
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 int size()
size in interface TemplateHashModelExsize in interface TemplateSequenceModelsize in class BeanModelpublic boolean isEmpty()
BeanModel
isEmpty in interface TemplateHashModelisEmpty in class BeanModel
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||