freemarker.testcase.models
Class IndexedModel1

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

public class IndexedModel1
extends java.lang.Object
implements TemplateIndexedModel

A trivial implementation of the TemplateIndexedModel interface.

Version:
$Id: IndexedModel1.java 1003 2004-10-16 14:54:58Z run2000 $
Author:
Nicholas Cull

Method Summary
 TemplateModel getAtIndex(long index)
          Get the value corresponding to the given index.
static IndexedModel1 getInstance()
          Get the singleton instance of this class.
 boolean isEmpty()
          Is the object empty?
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getInstance

public static IndexedModel1 getInstance()
Get the singleton instance of this class.

Returns:
a new object of this class

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

getAtIndex

public TemplateModel getAtIndex(long index)
                         throws TemplateModelException
Get the value corresponding to the given index. Traditionally this would correspond to an index into an array, or similar structure, such as a java.util.Vector.

Specified by:
getAtIndex in interface TemplateIndexedModel
Parameters:
index - the index of the underlying value we're interested in
Returns:
a TemplateModel representing the value for the given index
Throws:
TemplateModelException - the value could not be determined, possibly due to an index out-of-bounds, or an otherwise undefined value