|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Object | +--freemarker.template.SimpleList
A simple implementation of the TemplateListModel interface, using a LinkedList.
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 method, the SimpleList immediately copies all the elements and discards the TemplateListModel.
A SimpleList can also be given a shelf life; it then keeps track of the time elapsed since the last time it copied another TemplateListModel, or the last time its shelf life was set. Its owner can check whether it has become stale, and refresh it if necessary by copying data into it again.
All the public methods in this implementation are synchronized.
| Constructor Summary | |
SimpleList()
Constructs an empty SimpleList with an indefinite shelf life. |
|
SimpleList(java.util.LinkedList list)
Constructs a SimpleList from the given LinkedList with an
idenfinite shelf life. |
|
SimpleList(TemplateListModel listToCopy)
Constructs a SimpleList, copying into it the values from another TemplateListModel. |
|
SimpleList(TemplateModel[] list)
Constructs a SimpleList from the given Array of TemplateModels |
|
| Method Summary | |
void |
add(boolean b)
Adds a boolean to the end of this SimpleList, by first wrapping the boolean in a SimpleScalar. |
void |
add(java.lang.String s)
Adds a string to the end of this SimpleList, by first wrapping the string in a SimpleScalar. |
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 another TemplateListModel. |
TemplateModel |
get(int i)
|
int |
getShelfLife()
|
boolean |
hasNext()
|
boolean |
isEmpty()
|
boolean |
isPermanent()
|
boolean |
isRewound()
|
boolean |
isStale()
|
TemplateModel |
listSize()
|
TemplateModel |
next()
|
void |
rewind()
Resets the cursor to the beginning of the list. |
void |
setPermanent()
Gives this SimpleList an indefinite shelf life. |
void |
setShelfLife(int minutes)
Sets the amount of time before this SimpleList will become stale. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
public SimpleList()
public SimpleList(java.util.LinkedList list)
LinkedList with an
idenfinite shelf life.public SimpleList(TemplateModel[] list)
Array of TemplateModelspublic SimpleList(TemplateListModel listToCopy)
listToCopy - the list to be copied into this one.| Method Detail |
public void clear()
public void setShelfLife(int minutes)
minutes - the number of minutes before this
SimpleList will become stale.public int getShelfLife()
public void setPermanent()
public boolean isPermanent()
public boolean isStale()
public void copy(TemplateListModel listToCopy)
listToCopy - the list to be copied into this one.
public boolean isEmpty()
throws TemplateModelException
isEmpty in interface TemplateModelfreemarker.template.TemplateModel
public boolean isRewound()
throws TemplateModelException
isRewound in interface TemplateListModelfreemarker.template.TemplateListModelpublic 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 boolean hasNext()
throws TemplateModelException
hasNext in interface TemplateListModelfreemarker.template.TemplateListModel
public TemplateModel next()
throws TemplateModelException
next in interface TemplateListModelfreemarker.template.TemplateListModel
public void rewind()
throws TemplateModelException
TemplateListModelrewind in interface TemplateListModel
public TemplateModel listSize()
throws TemplateModelException
public TemplateModel get(int i)
throws TemplateModelException
get in interface TemplateListModelfreemarker.template.TemplateListModel
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||