freemarker.core
Class StringArraySequence

java.lang.Object
  extended by freemarker.core.StringArraySequence
All Implemented Interfaces:
TemplateModel, TemplateSequenceModel

public class StringArraySequence
extends java.lang.Object
implements TemplateSequenceModel

Sequence variable implementation that wraps a String[] with relatively low resource utilization. Warning: it does not copy the wrapped array, so do not modify that after the model was made!

Version:
$Id: StringArraySequence.java,v 1.2 2004/01/06 17:06:42 szegedia Exp $
Author:
Daniel Dekany

Field Summary
 
Fields inherited from interface freemarker.template.TemplateModel
NOTHING
 
Constructor Summary
StringArraySequence(java.lang.String[] stringArray)
          Warning: Does not copy the argument array!
 
Method Summary
 TemplateModel get(int index)
          Retrieves the i-th template model in this sequence.
 int size()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

StringArraySequence

public StringArraySequence(java.lang.String[] stringArray)
Warning: Does not copy the argument array!

Method Detail

get

public TemplateModel get(int index)
Description copied from interface: TemplateSequenceModel
Retrieves the i-th template model in this sequence.

Specified by:
get in interface TemplateSequenceModel
Returns:
the item at the specified index, or null if the index is out of bounds. Note that a null value is interpreted by FreeMarker as "variable does not exist", and accessing a missing variables is usually considered as an error in the FreeMarker Template Language, so the usage of a bad index will not remain hidden.

size

public int size()
Specified by:
size in interface TemplateSequenceModel
Returns:
the number of items in the list.