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 ) | size The size of the collection isEmpty Evaluates
to true if the collection is empty
|
List | iterator Evalutes to an Iterator over the List .
|
Map | keys Evalutes to a Set of all keys in the Map . values Evaluates
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 Map s (i.e. someMap["size"] gets the "size" key from the map, whereas someMap.size
gets the size of the Map . |
|
Set | iterator Evalutes to an Iterator over the Set .
|
Iterator | next Evalutes to the next object from the Iterator . hasNext Evaluates
to true if there is a next object available from the Iterator .
|
Enumeration | next Evalutes to the next object from the Enumeration . hasNext Evaluates to true if there is a next object available from the Enumeration . nextElement Synonym
for next . hasMoreElements Synonym for hasNext .
|