Pseudo-Properties for Collections
There are some special properties of collections that OGNL makes available. The reason for this is that the collections do not follow JavaBeans patterns for method naming; therefore the size(),
length(), etc. methods must be called instead of more intuitively referring to these as properties. OGNL corrects this by exposing certain pseudo-properties as if they were built-in.
Table 4.1. Special Collections Pseudo-Properties
| Collection | Special Properties |
|---|
Collection (inherited by Map, List & Set) | sizeThe size of the collection isEmptyEvaluates
to true if the collection is empty
|
| List | iteratorEvalutes to an Iterator over the List.
|
Map | keysEvalutes to a Set of all keys in the Map. valuesEvaluates
to a Collection of all values in the Map.
![[Note]](../images/admon/note.gif) | Note |
|---|
These properties, plus size and isEmpty,
are different than the indexed form of access for Maps (i.e. someMap["size"] gets the "size" key from the map, whereas someMap.size
gets the size of the Map. |
|
Set | iteratorEvalutes to an Iterator over the Set.
|
Iterator | nextEvalutes to the next object from the Iterator. hasNextEvaluates
to true if there is a next object available from the Iterator.
|
Enumeration | nextEvalutes to the next object from the Enumeration. hasNextEvaluates to true if there is a next object available from the Enumeration. nextElementSynonym
for next. hasMoreElementsSynonym for hasNext.
|