|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectfreemarker.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 wrapped| Method Detail |
|---|
public void setObject(java.lang.Object object)
ObjectWrapper
setObject in interface ObjectWrapperobject - the object to be wrapped
public boolean isEmpty()
throws TemplateModelException
TemplateModel
isEmpty in interface TemplateModeltrue if this object is empty, otherwise false
TemplateModelException
public TemplateModel get(java.lang.String key)
throws TemplateModelException
TemplateHashModelTemplateModel from the hash.
get in interface TemplateHashModelkey - 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 key
public TemplateIteratorModel templateIterator()
throws TemplateModelException
TemplateListModel2null if there are no elements in the list.
templateIterator in interface TemplateListModel2TemplateModelException - the next item in the list can't be
retrieved, or no next item exists.public void releaseIterator(TemplateIteratorModel iterator)
TemplateListModel2Returns 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 TemplateListModel2iterator - the iterator to be returned to the object pool, if any
public TemplateModel getAtIndex(long index)
throws TemplateModelException
TemplateIndexedModeljava.util.Vector.
getAtIndex in interface TemplateIndexedModelindex - 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 value
public void putAtIndex(long index,
TemplateModel model)
throws TemplateModelException
putAtIndex in interface TemplateWriteableIndexedModelindex - 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 value
public java.lang.Object getAsObject()
throws TemplateModelException
getAsObject in interface TemplateObjectModelTemplateModelException - the object could not be returned
public java.lang.String getAsString()
throws TemplateModelException
String.
getAsString in interface TemplateScalarModelString value of this scalar.
TemplateModelExceptionpublic java.lang.Object clone()
clone in interface ObjectWrapperclone in class java.lang.Objectjava.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 | ||||||||