Home » freemarker-2.3.13 » freemarker.ext.beans » [javadoc | source]
public class: EnumerationModel [javadoc | source]

All Implemented Interfaces:
    TemplateModelIterator, TemplateCollectionModel, AdapterTemplateModel, WrapperTemplateModel, TemplateHashModelEx

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

Using the model as a collection model is NOT thread-safe, as enumerations are inherently not thread-safe. Further, you can iterate over it only once. Attempts to call the #iterator() method after it was already driven to the end once will throw an exception.

Fields inherited from freemarker.ext.beans.BeanModel:
object,  wrapper,  FACTORY
 public EnumerationModel(Enumeration enumeration,
    BeansWrapper wrapper) 
    Creates a new model that wraps the specified enumeration object.
    enumeration - the enumeration object to wrap into a model.
    wrapper - the BeansWrapper associated with this model. Every model has to have an associated BeansWrapper instance. The model gains many attributes from its wrapper, including the caching behavior, method exposure level, method-over-item shadowing policy etc.
Method from freemarker.ext.beans.EnumerationModel Summary:
getAsBoolean,   hasNext,   iterator,   next
Methods from freemarker.ext.beans.BeanModel:
get,   getAdaptedObject,   getWrappedObject,   hasPlainGetMethod,   invokeGenericGet,   isEmpty,   keySet,   keys,   size,   toString,   unwrap,   values,   wrap
Methods from java.lang.Object:
equals,   getClass,   hashCode,   notify,   notifyAll,   toString,   wait,   wait,   wait
Method from freemarker.ext.beans.EnumerationModel Detail:
 public boolean getAsBoolean() 
    Returns Enumeration#hasMoreElements() . Therefore, an enumeration that has no more element evaluates to false, and an enumeration that has further elements evaluates to true.
 public boolean hasNext() 
 public TemplateModelIterator iterator() throws TemplateModelException 
    This allows the enumeration to be used in a <foreach> block.
 public TemplateModel next() throws TemplateModelException