freemarker.ext.beans
public class: ArrayModel [javadoc |
source]
java.lang.Object
freemarker.ext.beans.BeanModel
freemarker.ext.beans.ArrayModel
All Implemented Interfaces:
TemplateSequenceModel, TemplateCollectionModel, AdapterTemplateModel, WrapperTemplateModel, TemplateHashModelEx
A class that will wrap an arbitrary array into TemplateCollectionModel
and TemplateSequenceModel interfaces. It supports element retrieval through the array[index]
syntax and can be iterated as a list.
- author:
Attila - Szegedi
- version:
$ - Id: ArrayModel.java,v 1.26 2003/06/03 13:21:32 szegedia Exp $
| Field Summary |
|---|
| static final ModelFactory | FACTORY | |
| Constructor: |
public ArrayModel(Object array,
BeansWrapper wrapper) {
super(array, wrapper);
Class clazz = array.getClass();
if(!clazz.isArray())
throw new IllegalArgumentException("Object is not an array, it is " + array.getClass().getName());
length = Array.getLength(array);
}
Creates a new model that wraps the specified array object. Parameters:
array - the array 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.
Throws:
IllegalArgumentException - if the passed object is not a Java array.
|
| Methods from freemarker.ext.beans.BeanModel: |
|---|
|
get, getAdaptedObject, getWrappedObject, hasPlainGetMethod, invokeGenericGet, isEmpty, keySet, keys, size, toString, unwrap, values, wrap |