freemarker.testcase.models

Class MultiModel1

Implemented Interfaces:
TemplateHashModel, TemplateModel, TemplateScalarModel, TemplateSequenceModel

public class MultiModel1
extends java.lang.Object
implements TemplateHashModel, TemplateSequenceModel, TemplateScalarModel

Testcase to see how FreeMarker deals with multiple Template models.
Version:
$Id: MultiModel1.java,v 1.17 2004/01/06 17:06:44 szegedia Exp $

Fields inherited from interface freemarker.template.TemplateModel

NOTHING

Fields inherited from interface freemarker.template.TemplateScalarModel

EMPTY_STRING

Constructor Summary

MultiModel1()
Creates new MultiModel1

Method Summary

TemplateModel
get(String key)
Gets a TemplateModel from the hash.
TemplateModel
get(int i)
String
getAsString()
Returns the scalar's value as a String.
boolean
isEmpty()
int
size()

Constructor Details

MultiModel1

public MultiModel1()
Creates new MultiModel1

Method Details

get

public TemplateModel get(String key)
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.

get

public TemplateModel get(int i)
            throws TemplateModelException
Specified by:
get in interface TemplateSequenceModel
Returns:
the specified index in the list

getAsString

public String getAsString()
Returns the scalar's value as a String.
Specified by:
getAsString in interface TemplateScalarModel
Returns:
the String value of this scalar.

isEmpty

public boolean isEmpty()
Specified by:
isEmpty in interface TemplateHashModel
Returns:
true if this object is empty.

size

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