|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectfreemarker.template.SimpleList
public class SimpleList
A synchronized implementation of the TemplateListModel2
interface, using an underlying List implementation.
A SimpleList can act as a cache for another
TemplateListModel, e.g. one that gets data from a
database. When passed another TemplateListModel as an
argument to its constructor or to its copy(TemplateListModel) method,
the SimpleList immediately copies all the elements and
discards the TemplateListModel.
All the public methods in this implementation are synchronized.
Note that as of 1.8, this model has been retrofitted to the
TemplateListModel2 interface.
SimpleHash,
SimpleScalar,
SimpleNumber,
Serialized Form| Field Summary | |
|---|---|
protected java.util.List<TemplateModel> |
list
The contents of this SimpleList are stored in this
List object. |
| Constructor Summary | |
|---|---|
SimpleList()
Constructs an empty SimpleList. |
|
SimpleList(java.util.List<? extends TemplateModel> list)
Constructs a SimpleList from the given List. |
|
SimpleList(TemplateListModel listToCopy)
Constructs a SimpleList, copying into it the
values from another TemplateListModel. |
|
SimpleList(TemplateListModel2 listToCopy)
Constructs a SimpleList, copying into it the
values from another TemplateListModel2. |
|
SimpleList(TemplateModel[] arr)
Constructs a SimpleList from the given Array of
TemplateModels. |
|
| Method Summary | |
|---|---|
void |
add(boolean bool)
Adds a boolean to the end of this SimpleList, by
wrapping the boolean in a FastBoolean. |
void |
add(long n)
Adds a number to the end of this SimpleList,
by wrapping the string in a FastNumber. |
void |
add(java.lang.Number n)
Adds a number to the end of this SimpleList,
by wrapping the string in a FastNumber. |
void |
add(java.lang.String s)
Adds a string to the end of this SimpleList,
by wrapping the string in a FastScalar. |
void |
add(TemplateModel element)
Adds a TemplateModel to the end of this SimpleList. |
void |
clear()
Removes all the elements from this SimpleList. |
void |
copy(TemplateListModel listToCopy)
Discards the contents of this SimpleList, and copies into
it the values from a TemplateListModel object. |
void |
copy(TemplateListModel2 listToCopy)
Discards the contents of this SimpleList, and copies into
it the values from another TemplateListModel2. |
void |
copy(TemplateModel[] arr)
Discards the contents of this SimpleList, and copies into
it the values from the given Array of TemplateModels. |
boolean |
equals(java.lang.Object o)
Tests this object for equality with the given object. |
java.lang.Object |
getAsObject()
Return an unmodifiable copy of the underlying List object
for manipulation by the freemarker.ext.beans package. |
TemplateModel |
getAtIndex(long index)
Retrieves the specified item from the list. |
int |
hashCode()
Return the hash value for this object. |
boolean |
isEmpty()
Is the underlying List empty? |
void |
releaseIterator(TemplateIteratorModel iterator)
Returns the used iterator to the list model. |
TemplateIteratorModel |
templateIterator()
Retrieves an iterator to iterate over this list. |
java.lang.String |
toString()
Retrieve the value of this object as a String. |
| Methods inherited from class java.lang.Object |
|---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
protected java.util.List<TemplateModel> list
SimpleList are stored in this
List object.
| Constructor Detail |
|---|
public SimpleList()
SimpleList.
public SimpleList(java.util.List<? extends TemplateModel> list)
SimpleList from the given List.
A defensive copy of the list is made.
list - the list of values to be copied into this
SimpleList
java.lang.NullPointerException - the list value is nullpublic SimpleList(TemplateModel[] arr)
SimpleList from the given Array of
TemplateModels.
arr - the array to be copied into the underlying List.
java.lang.NullPointerException - the array to be copied is null
public SimpleList(TemplateListModel listToCopy)
throws TemplateModelException
SimpleList, copying into it the
values from another TemplateListModel.
listToCopy - the list to be copied into this one.
TemplateModelException - something went wrong while copying the
given list into the SimpleList.
java.lang.NullPointerException - the list to be copied is null
public SimpleList(TemplateListModel2 listToCopy)
throws TemplateModelException
SimpleList, copying into it the
values from another TemplateListModel2.
listToCopy - the list to be copied into this one.
TemplateModelException - something went wrong while copying the
given list into the SimpleList.
java.lang.NullPointerException - the list to be copied is null| Method Detail |
|---|
public void clear()
SimpleList.
public void copy(TemplateListModel listToCopy)
throws TemplateModelException
SimpleList, and copies into
it the values from a TemplateListModel object.
listToCopy - the list to be copied into this one.
TemplateModelException - something went wrong while copying the
given list into the SimpleList.
java.lang.NullPointerException - the list to be copied is null
public void copy(TemplateListModel2 listToCopy)
throws TemplateModelException
SimpleList, and copies into
it the values from another TemplateListModel2.
listToCopy - the list to be copied into this one.
TemplateModelException - something went wrong while copying the
given list into the SimpleList.
java.lang.NullPointerException - the list to be copied is nullpublic void copy(TemplateModel[] arr)
SimpleList, and copies into
it the values from the given Array of TemplateModels.
arr - the array to be copied into the underlying list.
java.lang.NullPointerException - the array to be copied is null
public boolean isEmpty()
throws TemplateModelException
List empty?
isEmpty in interface TemplateModeltrue if the list is empty, otherwise false
TemplateModelExceptionpublic void add(TemplateModel element)
TemplateModel to the end of this SimpleList.
element - the TemplateModel to be added.public void add(java.lang.String s)
SimpleList,
by wrapping the string in a FastScalar.
s - the String to be added.public void add(java.lang.Number n)
SimpleList,
by wrapping the string in a FastNumber.
n - the Number to be added.public void add(long n)
SimpleList,
by wrapping the string in a FastNumber.
n - the Number to be added.public void add(boolean bool)
SimpleList, by
wrapping the boolean in a FastBoolean.
bool - the boolean to be added.
public TemplateIteratorModel templateIterator()
throws TemplateModelException
templateIterator in interface TemplateListModel2TemplateModelException - the next item in the list can't be
retrieved, or no next item exists.public void releaseIterator(TemplateIteratorModel iterator)
releaseIterator in interface TemplateListModel2iterator - the iterator to be returned to the object pool, if any
public TemplateModel getAtIndex(long index)
throws TemplateModelException
getAtIndex in interface TemplateIndexedModelindex - the index of the item to be retrieved.
TemplateModelException - the specified item in the list can't be
retrieved, or the index is out of bounds.
public java.lang.Object getAsObject()
throws TemplateModelException
List object
for manipulation by the freemarker.ext.beans package.
getAsObject in interface TemplateObjectModelList object
TemplateModelException - the object could not be returnedpublic java.lang.String toString()
String.
toString in class java.lang.Objectpublic boolean equals(java.lang.Object o)
equals in class java.lang.Objecto - the object to be compared with
true if the objects are equal, otherwise
falsepublic int hashCode()
hashCode in class java.lang.Object
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||