Dashboard > OGNL > Home > Projecting across Collection
  OGNL Log In View a printable version of the current page.  
  Projecting across Collection
Added by tm_jee, last edited by tm_jee on Dec 21, 2007  (view change)
Labels: 
(None)

OGNL provides a simple way to call the same method or extract the same property from each element in a collection and store the results in a new collection. We call this "projection," from the database term for choosing a subset of columns from a table. For example, this expression:

listeners.{delegate}

returns a list of all the listeners' delegates. See the coercion section for how OGNL treats various kinds of objects as collections.

During a projection the #this variable refers to the current element of the iteration.

objects.{ #this instanceof String ? #this : #this.toString()}

The above would produce a new list of elements from the objects list as string values.

Site powered by a free Open Source Project / Non-profit License (more) of Confluence - the Enterprise wiki.
Learn more or evaluate Confluence for your organisation.
Powered by Atlassian Confluence, the Enterprise Wiki. (Version: 2.2.9 Build:#527 Sep 07, 2006) - Bug/feature request - Contact Administrators