|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--freemarker.template.SimpleSequence
A convenient implementation of a list. This object implements TemplateSequenceModel, using an underlying java.util.List implementation.
A SimpleSequence can act as a cache for a TemplateCollectionModel, e.g. one that gets data from a database. When passed a TemplateCollectionModel as an argument to its constructor, the SimpleSequence immediately copies all the elements and discards the TemplateCollectionModel.
Note:
As of 2.0, this class is unsynchronized by default. To obtain a
synchronized wrapper, call the synchronizedWrapper()
method.
SimpleHash
,
SimpleScalar
, Serialized FormField Summary | |
protected java.util.List |
list
|
Constructor Summary | |
SimpleSequence()
Constructs an empty SimpleSequence with an indefinite shelf life. |
|
SimpleSequence(java.util.List list)
Constructs a SimpleSequence from the given List It makes a copy for internal use. |
|
SimpleSequence(TemplateCollectionModel tcm)
|
Method Summary | |
void |
add(boolean b)
Adds a boolean to the end of this SimpleSequence, by first wrapping the boolean in a SimpleScalar. |
void |
add(java.lang.String s)
Adds a string to the end of this SimpleSequence, by first wrapping the string in a SimpleScalar. |
void |
add(TemplateModel element)
Adds a string to the end of this SimpleSequence, by first wrapping the string in a SimpleScalar. |
TemplateModel |
get(int i)
Retrieves the i-th template model in this sequence. |
boolean |
isEmpty()
Is the underlying List empty? |
int |
size()
|
SimpleSequence |
synchronizedWrapper()
|
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
protected java.util.List list
Constructor Detail |
public SimpleSequence()
public SimpleSequence(java.util.List list)
public SimpleSequence(TemplateCollectionModel tcm) throws TemplateModelException
Method Detail |
public boolean isEmpty() throws TemplateModelException
isEmpty
in interface TemplateModel
freemarker.template.TemplateModel
public void add(TemplateModel element)
element
- the TemplateModel to be added.public void add(java.lang.String s)
element
- the string to be added.public void add(boolean b)
element
- the boolean to be added.public TemplateModel get(int i) throws TemplateModelException
TemplateSequenceModel
get
in interface TemplateSequenceModel
public int size()
size
in interface TemplateSequenceModel
freemarker.template.TemplateSequenceModel
public SimpleSequence synchronizedWrapper()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |