freemarker.ext.beans
Class EnumerationModel

java.lang.Object
  |
  +--freemarker.ext.beans.BeanModelBase
        |
        +--freemarker.ext.beans.BeanModel
              |
              +--freemarker.ext.beans.EnumerationModel
All Implemented Interfaces:
TemplateHashModel, TemplateModel, TemplateModelIterator, TemplateScalarModel

public final class EnumerationModel
extends BeanModel
implements TemplateModelIterator

A class that adds TemplateModelIterator functionality to the Enumeration interface implementers.

Version:
1.0
Author:
Attila Szegedi, szegedia@freemail.hu

Fields inherited from class freemarker.ext.beans.BeanModel
TYPE_ARRAY, TYPE_COLLECTION, TYPE_ENUMERATION, TYPE_ITERATOR, TYPE_MAP, TYPE_OBJECT, TYPE_OBJECT_BASE, TYPE_RESOURCE_BUNDLE
 
Constructor Summary
EnumerationModel(java.util.Enumeration enumeration)
          Creates a new model that wraps the specified enumeration object.
 
Method Summary
static EnumerationModel getInstance(java.util.Enumeration object)
          Returns a model wrapping the specified enumeration object.
 int getType()
          Returns the type of this object (which is TYPE_ENUMERATION)
 boolean hasNext()
           
 TemplateModel next()
          Calls Iterator.next().
 
Methods inherited from class freemarker.ext.beans.BeanModel
get, getAsString, getInstance, getInstance, getObject, invokeGenericGet, isEmpty
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface freemarker.template.TemplateModel
isEmpty
 

Constructor Detail

EnumerationModel

public EnumerationModel(java.util.Enumeration enumeration)
Creates a new model that wraps the specified enumeration object.
Parameters:
object - the enumeration object to wrap into a model.
Method Detail

getInstance

public static final EnumerationModel getInstance(java.util.Enumeration object)
Returns a model wrapping the specified enumeration object. It always returns a new object, as Enumerations are considered short-lived and caching them would have little sense.
Returns:
the model for the enumeration

getType

public int getType()
Returns the type of this object (which is TYPE_ENUMERATION)
Overrides:
getType in class BeanModel

next

public TemplateModel next()
Calls Iterator.next().
Specified by:
next in interface TemplateModelIterator

hasNext

public boolean hasNext()
Specified by:
hasNext in interface TemplateModelIterator
Following copied from interface: freemarker.template.TemplateModelIterator
Returns:
whether there are any more items to iterate over.