Skip to main content

Notice: this Wiki will be going read only early in 2024 and edits will no longer be possible. Please see: https://gitlab.eclipse.org/eclipsefdn/helpdesk/-/wikis/Wiki-shutdown-plan for the plan.

Jump to: navigation, search

Java 1 5 Support

Revision as of 18:55, 29 September 2006 by Cameron.bateman.oracle.com (Talk | contribs) (Generics)

Overview

Unified EL adds support for Java 5. Java 5 enumerations are directly supported as types in EL expressions. Java 5 generics cannot be used directly, but symbols can now typed using generics, so symbol and type resolution is now affected.


Enumerations

The following is an example of enumeration use in an EL expression:

#{myColor == 'blue'}

Let's say that myColor resolves to an instance of a Java enumeration Color. EL will attempt to coerce 'blue' to a enumeration value the Color type in order to make the comparison. This creates several possible validation opportunities:

  • is 'blue' coerciable to an Enumeration? If not, the JSF runtime may throw an exception.
  • is Enum.valueOf(Color.class, 'blue') a valid value? If 'blue' is not a valid value for Color, this will cause an IllegalArgumentException at runtime.

In both cases we should be able to validate these issues.


Generics

The support for generics in Unified EL provides new validation opportunities and support requirements. Consider the following expression:

#{mapVar['key'] > 8}

If mapVar resolves to a java.util.Map, then we can check the following things:

  • is mapVar a Map<String,

Back to the top