freemarker.testcase.models
Class MultiModel5

java.lang.Object
  extended by freemarker.testcase.models.MultiModel5
All Implemented Interfaces:
TemplateHashModel, TemplateIndexedModel, TemplateListModel2, TemplateModel

public final class MultiModel5
extends java.lang.Object
implements TemplateListModel2, TemplateIndexedModel, TemplateHashModel

Testcase to see how FM-Classic deals with multiple Template models.

Version:
$Id: MultiModel5.java 1104 2005-09-08 11:40:41Z run2000 $
See Also:
MultiModel1, MultiModel2, MultiModel3, MultiModel4

Constructor Summary
MultiModel5()
          Creates new MultiModel5.
 
Method Summary
 TemplateModel get(java.lang.String key)
          Gets a TemplateModel from the hash.
 TemplateModel getAtIndex(long index)
          Retrieves the specified item from the list.
 boolean isEmpty()
          Is the object empty?
 void releaseIterator(TemplateIteratorModel iterator)
          Returns the used iterator to the list model.
 TemplateIteratorModel templateIterator()
          Retrieves an iterator to iterate over this list.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MultiModel5

public MultiModel5()
Creates new MultiModel5.

Method Detail

templateIterator

public TemplateIteratorModel templateIterator()
                                       throws TemplateModelException
Retrieves an iterator to iterate over this list.

Specified by:
templateIterator in interface TemplateListModel2
Returns:
an iterator to iterate over the current list.
Throws:
TemplateModelException - the next item in the list can't be retrieved, or no next item exists.

releaseIterator

public void releaseIterator(TemplateIteratorModel iterator)
Returns the used iterator to the list model.

Specified by:
releaseIterator in interface TemplateListModel2
Parameters:
iterator - the iterator to be returned to the object pool

getAtIndex

public TemplateModel getAtIndex(long index)
                         throws TemplateModelException
Retrieves the specified item from the list.

Specified by:
getAtIndex in interface TemplateIndexedModel
Parameters:
index - the index of the item to be retrieved.
Returns:
the specified index in the list.
Throws:
TemplateModelException - the specified item in the list can't be retrieved, or the index is out of bounds.

isEmpty

public boolean isEmpty()
                throws TemplateModelException
Is the object empty?

Specified by:
isEmpty in interface TemplateModel
Returns:
true if this object is empty, otherwise false
Throws:
TemplateModelException

get

public TemplateModel get(java.lang.String key)
                  throws TemplateModelException
Gets a TemplateModel from the hash.

Specified by:
get in interface TemplateHashModel
Parameters:
key - the name by which the TemplateModel is identified in the template.
Returns:
the TemplateModel referred to by the key, or null if not found.
Throws:
TemplateModelException - there was a problem getting the value for the given key