|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Object
|
+--org.szegedi.expose.model.ReflectionObjectModelBase
|
+--org.szegedi.expose.model.ReflectionObjectModel
|
+--org.szegedi.expose.model.ReflectionMapModel
A special case of ReflectionObjectModel that adds implementation
for TemplateListModel and TemplateMethodModel on map objects.
List model will iterate through entries, while method model is a shortcut for the
Map.get() method.
Using the model as a list model is thread-safe, as it maintains an iterator
on a per-thread basis.
| Fields inherited from class org.szegedi.expose.model.ReflectionObjectModelBase |
TYPE_ARRAY, TYPE_COLLECTION, TYPE_ENUMERATION, TYPE_ITERATOR, TYPE_MAP, TYPE_OBJECT, TYPE_OBJECT_BASE, TYPE_RESOURCE_BUNDLE |
| Constructor Summary | |
ReflectionMapModel(java.util.Map map)
Creates a new model that wraps the specified map object. |
|
| Method Summary | |
freemarker.template.TemplateModel |
exec(java.util.List arguments)
The first argument is used as a key to call the map's get method. |
freemarker.template.TemplateModel |
get(int index)
Throws an UnsupportedOperationException as map entry set elements can not be accessed at random. |
static ReflectionMapModel |
getInstance(java.util.Map object)
Returns a model wrapping the specified map object. |
int |
getType()
Returns the type of this object (which is TYPE_MAP) |
boolean |
hasNext()
Calls Iterator.hasNext(). |
boolean |
isEmpty()
Returns true if the underlying map is empty. |
boolean |
isRewound()
Always return false to force calling rewind. |
freemarker.template.TemplateModel |
listSize()
Returns a Simple scalar with a string containing the decimal representation of the map size. |
freemarker.template.TemplateModel |
next()
Calls Iterator.next() and wraps the returned Map.Entry into a
template model. |
void |
rewind()
Creates a new iterator on the map's entry set that will be used to implement other TemplateListModel methods. |
| Methods inherited from class org.szegedi.expose.model.ReflectionObjectModel |
get, getInstance |
| Methods inherited from class org.szegedi.expose.model.ReflectionObjectModelBase |
getAsString, getInstance, getObject |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
public ReflectionMapModel(java.util.Map map)
object - the map object to wrap into a model.| Method Detail |
public static final ReflectionMapModel getInstance(java.util.Map object)
WeakReference objects. The caching can be turned
off by setting the expose.reflection.nocache system property to
true. In this case calling this method is equivalent to constructing a new model.object - the map to wrap into a model.public int getType()
getType in class ReflectionObjectModelpublic boolean hasNext()
Iterator.hasNext().hasNext in interface freemarker.template.TemplateListModelpublic boolean isRewound()
isRewound in interface freemarker.template.TemplateListModelpublic freemarker.template.TemplateModel next()
Iterator.next() and wraps the returned Map.Entry into a
template model.next in interface freemarker.template.TemplateListModelpublic void rewind()
TemplateListModel methods.rewind in interface freemarker.template.TemplateListModelpublic freemarker.template.TemplateModel exec(java.util.List arguments)
exec in interface freemarker.template.TemplateMethodModelpublic boolean isEmpty()
isEmpty in interface freemarker.template.TemplateModelisEmpty in class ReflectionObjectModelBasepublic freemarker.template.TemplateModel get(int index)
public freemarker.template.TemplateModel listSize()
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||