Save This Page
Home » freemarker-2.3.13 » freemarker.ext.beans » [javadoc | source]
freemarker.ext.beans
public class: CollectionModel [javadoc | source]
java.lang.Object
   freemarker.ext.beans.BeanModel
      freemarker.ext.beans.StringModel
         freemarker.ext.beans.CollectionModel

All Implemented Interfaces:
    TemplateSequenceModel, TemplateCollectionModel, TemplateScalarModel, AdapterTemplateModel, WrapperTemplateModel, TemplateHashModelEx

A special case of BeanModel that can wrap Java collections and that implements the TemplateCollectionModel in order to be usable in a <foreach> block.

Field Summary
static final  ModelFactory FACTORY     
Fields inherited from freemarker.ext.beans.StringModel:
FACTORY
Fields inherited from freemarker.ext.beans.BeanModel:
object,  wrapper,  FACTORY
Constructor:
 public CollectionModel(Collection collection,
    BeansWrapper wrapper) 
    Creates a new model that wraps the specified collection object.
    Parameters:
    collection - the collection 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.CollectionModel Summary:
get,   iterator,   size
Methods from freemarker.ext.beans.StringModel:
getAsString
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.CollectionModel Detail:
 public TemplateModel get(int index) throws TemplateModelException 
    Retrieves the i-th object from the collection, wrapped as a TemplateModel.
 public TemplateModelIterator iterator() 
 public int size()