|
||||||||
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(TemplateListModel listToCopy)
Constructs a SimpleList, copying into it the values from another TemplateListModel. |
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. |
int |
getShelfLife()
|
boolean |
hasNext()
|
boolean |
isEmpty()
|
boolean |
isPermanent()
|
boolean |
isRewound()
|
boolean |
isStale()
|
TemplateModel |
next()
|
void |
rewind()
|
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(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
public boolean isRewound() throws TemplateModelException
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 boolean hasNext() throws TemplateModelException
public TemplateModel next() throws TemplateModelException
public void rewind() throws TemplateModelException
|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |