freemarker.ext.beans
Class EnumerationModel

java.lang.Object
  extended by freemarker.ext.beans.ObjectModelBase
      extended by freemarker.ext.beans.ObjectModel
          extended by freemarker.ext.beans.EnumerationModel
All Implemented Interfaces:
TemplateHashModel, TemplateListModel2, TemplateModel, TemplateObjectModel, TemplateScalarModel, java.io.Serializable

Deprecated. this class is deprecated in favour of the classes in the freemarker.ext.beans2 package

public final class EnumerationModel
extends ObjectModel
implements TemplateListModel2

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

Using the model as a list model is NOT thread-safe, as enumerations are inherently not thread-safe.

Version:
$Id: EnumerationModel.java 1101 2013-04-01 04:17:32Z run2000 $
Author:
Attila Szegedi, attila@szegedi.org
See Also:
Serialized Form

Field Summary
 
Fields inherited from class freemarker.ext.beans.ObjectModelBase
object
 
Constructor Summary
EnumerationModel(java.util.Enumeration enumeration)
          Deprecated. Creates a new model that wraps the specified enumeration object.
 
Method Summary
static EnumerationModel getInstance(java.util.Enumeration object)
          Deprecated. Returns a model wrapping the specified enumeration object.
 freemarker.ext.beans.ObjectModelBase.ModelType getType()
          Deprecated. Returns the type of this object (which is TYPE_ENUMERATION).
 boolean isEmpty()
          Deprecated. Returns true if the enumeration is null or the enumeration has no more elements, otherwise false.
 void releaseIterator(TemplateIteratorModel iterator)
          Deprecated. Release the underlying enumerator, so that we don't try to walk over it again
 TemplateIteratorModel templateIterator()
          Deprecated. Retrieve a TemplateIteratorModel for this enumeration.
 
Methods inherited from class freemarker.ext.beans.ObjectModel
get, getInstance
 
Methods inherited from class freemarker.ext.beans.ObjectModelBase
getAsObject, getAsString, getInstance
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

EnumerationModel

public EnumerationModel(java.util.Enumeration enumeration)
Deprecated. 
Creates a new model that wraps the specified enumeration object.

Parameters:
enumeration - the enumeration object to wrap into a model.
Method Detail

isEmpty

public boolean isEmpty()
Deprecated. 
Returns true if the enumeration is null or the enumeration has no more elements, otherwise false.

Specified by:
isEmpty in interface TemplateModel
Overrides:
isEmpty in class ObjectModelBase
Returns:
true if this object is empty, otherwise false

getInstance

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

Returns:
the model for the enumeration

getType

public freemarker.ext.beans.ObjectModelBase.ModelType getType()
Deprecated. 
Returns the type of this object (which is TYPE_ENUMERATION).

Overrides:
getType in class ObjectModel

templateIterator

public TemplateIteratorModel templateIterator()
                                       throws TemplateModelException
Deprecated. 
Retrieve a TemplateIteratorModel for this enumeration.

Specified by:
templateIterator in interface TemplateListModel2
Returns:
the iterator model for walking over this enumeration
Throws:
TemplateModelException - the enumeration has already been spent

releaseIterator

public void releaseIterator(TemplateIteratorModel iterator)
Deprecated. 
Release the underlying enumerator, so that we don't try to walk over it again

Specified by:
releaseIterator in interface TemplateListModel2
Parameters:
iterator - the iterator that just walked over the enumeration