OGNL
Object -Graph Navigation Language, abbreviated as OGNL is an expression language for reading and writing of properties in Java objects. To be used to set and read the value of a property of the same terms. Can be used OGNL for example, when binding a presentation layer ( GUI) to an object in a data model. It also allows OGNL "projection", "selection" and pseudo- lambda expressions.
In a "projection" the same method is invoked or accessed on the same property and the result of this operation (s ) in turn stored in a collection of all elements of a collection.
In a "selection" are a set of elements of a vector specific items that meet the stated condition, saved as a result in a new vector.
OGNL has a simplified lambda expression syntax, which allows you to write simple functions.
Examples
An OGNL expression
Code.toLowerCase (). getBytes (). intValue.toString ()
- Retrieves the property "code",
- Calls the toLowerCase () method on the resulting string,
- Calls the method getBytes () on the resulting string
- Byte is extracted from the resulting array to the first value, that encapsulates a byte object
- For which in turn the intValue property is determined ( by calling the method intValue ()),
- The resulting int is in turn encapsulated in an Integer object, which is obtained by calling the toString () method is converted to a string.
Projectiondesign
Listeners. { delegate }
A list of all the delegates Collection listeners back.
Selection
Listeners. {? # this instanceof KeyListener }
Is a vector back all of the listener, which are KeyListener.