|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object freemarker.ext.beans2.ArrayWrapper
public class ArrayWrapper
Wrapper for an array object. Provides list and indexed access to elements of the wrapped array.
Constructor Summary | |
---|---|
ArrayWrapper()
Default constructor where an array is not provided initially. |
|
ArrayWrapper(java.lang.Object object)
Constructor that takes an array object to be wrapped. |
Method Summary | |
---|---|
java.lang.Object |
clone()
Creates and returns a copy of this object. |
TemplateModel |
get(java.lang.String key)
Gets a TemplateModel from the hash. |
java.lang.Object |
getAsObject()
Return the underlying object to the reflection mechanism. |
java.lang.String |
getAsString()
Returns the array's value as a String . |
TemplateModel |
getAtIndex(long index)
Get the value corresponding to the given index. |
boolean |
isEmpty()
Is the object empty? |
void |
putAtIndex(long index,
TemplateModel model)
Set the value corresponding to the given index. |
void |
releaseIterator(TemplateIteratorModel iterator)
Returns the used iterator to the list model. |
void |
setObject(java.lang.Object object)
Sets the object to be wrapped by this object wrapper. |
TemplateIteratorModel |
templateIterator()
Retrieves an iterator to iterate over this list. |
Methods inherited from class java.lang.Object |
---|
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public ArrayWrapper()
public ArrayWrapper(java.lang.Object object)
object
- the array object to be wrappedMethod Detail |
---|
public void setObject(java.lang.Object object)
ObjectWrapper
setObject
in interface ObjectWrapper
object
- the object to be wrappedpublic boolean isEmpty() throws TemplateModelException
TemplateModel
isEmpty
in interface TemplateModel
true
if this object is empty, otherwise false
TemplateModelException
public TemplateModel get(java.lang.String key) throws TemplateModelException
TemplateHashModel
TemplateModel
from the hash.
get
in interface TemplateHashModel
key
- the name by which the TemplateModel
is identified in the template.
TemplateModel
referred to by the key,
or null
if not found.
TemplateModelException
- there was a problem getting the value
for the given keypublic TemplateIteratorModel templateIterator() throws TemplateModelException
TemplateListModel2
null
if there are no elements in the list.
templateIterator
in interface TemplateListModel2
TemplateModelException
- the next item in the list can't be
retrieved, or no next item exists.public void releaseIterator(TemplateIteratorModel iterator)
TemplateListModel2
Returns the used iterator to the list model. Implement this method
when you want to use an object pool of TemplateIterator
objects.
Otherwise, leave the implementation of this method blank.
Note that if the iterator returned in TemplateListModel2.templateIterator()
is
null
, this method will not be called for the
null
iterator.
releaseIterator
in interface TemplateListModel2
iterator
- the iterator to be returned to the object pool, if anypublic TemplateModel getAtIndex(long index) throws TemplateModelException
TemplateIndexedModel
java.util.Vector
.
getAtIndex
in interface TemplateIndexedModel
index
- the index of the underlying value we're interested in
TemplateModel
representing the value for the given index
TemplateModelException
- the value could not be determined, possibly
due to an index out-of-bounds, or an otherwise undefined valuepublic void putAtIndex(long index, TemplateModel model) throws TemplateModelException
putAtIndex
in interface TemplateWriteableIndexedModel
index
- the index of the underlying value we're interested inmodel
- the model to be added to the list
TemplateModelException
- the value could not be determined, possibly
due to an index out-of-bounds, or an otherwise undefined valuepublic java.lang.Object getAsObject() throws TemplateModelException
getAsObject
in interface TemplateObjectModel
TemplateModelException
- the object could not be returnedpublic java.lang.String getAsString() throws TemplateModelException
String
.
getAsString
in interface TemplateScalarModel
String
value of this scalar.
TemplateModelException
public java.lang.Object clone()
clone
in interface ObjectWrapper
clone
in class java.lang.Object
java.lang.RuntimeException
- the clone operation was not successful
java.lang.OutOfMemoryError
- if there is not enough memory.Cloneable
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |