freemarker.testcase.models
Class SortedHash

java.lang.Object
  |
  +--freemarker.testcase.models.SortedHash
All Implemented Interfaces:
TemplateHashModel, TemplateModel, TemplateObjectModel

public class SortedHash
extends java.lang.Object
implements TemplateHashModel, TemplateObjectModel

Simple hash model that contains a sorted hash.

Version:
$Id: SortedHash.java,v 1.1 2003/11/17 13:21:05 run2000 Exp $
Author:
Nicholas Cull

Constructor Summary
SortedHash()
          Default constructor that creates a simple sorted map.
 
Method Summary
 TemplateModel get(java.lang.String key)
          Gets a TemplateModel from the hash.
 java.lang.Object getAsObject()
          Return the underlying object to the reflection mechanism in the freemarker.ext.beans package.
 boolean isEmpty()
          Is the object empty?
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SortedHash

public SortedHash()
Default constructor that creates a simple sorted map.
Method Detail

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

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.

getAsObject

public java.lang.Object getAsObject()
                             throws TemplateModelException
Return the underlying object to the reflection mechanism in the freemarker.ext.beans package. Any variables, methods or properties can be called directly via reflection.

Specified by:
getAsObject in interface TemplateObjectModel
Returns:
the underlying object for this template model
Throws:
TemplateModelException - the object could not be returned