Top Description Fields Constructors Methods
com.sun.faces.context.flash

public Class FlashELResolver

extends ELResolver
Class Inheritance
Imports
javax.el.ELContext, .ELResolver, .PropertyNotFoundException, .PropertyNotWritableException, javax.faces.context.ExternalContext, .FacesContext, .Flash, .FlashFactory, java.beans.FeatureDescriptor, java.util.ArrayList, .Iterator, .Map, javax.faces.FactoryFinder

Provide a feature semantically identical to the "flash" concept in Ruby on Rails.

The feature is exposed to users via a custom ELResolver which introduces a new implicit object, flash. The flash functions as Map and can be used in getValue( ) or setValue( ) expressions.

Usage

Related Classes

The complete list of classes that make up this feature is

Field Summary

Modifier and TypeField and Description
private static final String
private static final String
private static final String
Inherited from javax.el.ELResolver:
RESOLVABLE_AT_DESIGN_TIMETYPE

Constructor Summary

AccessConstructor and Description
public
FlashELResolver()

Not intended for manual invocation.

Method Summary

Modifier and TypeMethod and Description
public Class<?>
getCommonPropertyType(ELContext
The context of this evaluation.
context
,
Object
The base object to return the most general property type for, or null to enumerate the set of top-level variables that this resolver can evaluate.
base
)

Implements abstract javax.el.ELResolver.getCommonPropertyType.

If base is non-null and is the literal string "flash", return Object.class.

public Iterator<FeatureDescriptor>
getFeatureDescriptors(ELContext
The context of this evaluation.
elContext
,
Object
The base object whose set of valid properties is to be enumerated, or null to enumerate the set of top-level variables that this resolver can evaluate.
base
)

Implements abstract javax.el.ELResolver.getFeatureDescriptors.

Returns an iterator of FeatureDescriptors for the current contents of the flash.

public Class<?>
getType(ELContext
The context of this evaluation.
elContext
,
Object
The base object whose property value is to be analyzed, or null to analyze a top-level variable.
base
,
Object
The property or variable to return the acceptable type for.
property
)

Implements abstract javax.el.ELResolver.getType.

Return the valid Class for a future set operation, which will always be null because sets happen via the MapELResolver operating on the ELFlash instance as a Map.

public Object
getValue(ELContext
The context of this evaluation.
elContext
,
Object
The base object whose property value is to be returned, or null to resolve a top-level variable.
base
,
Object
The property or variable to be resolved.
property
)

Implements abstract javax.el.ELResolver.getValue.

Hook into the EL resolution process to introduce the flash implicit object.

public boolean
isReadOnly(ELContext
The context of this evaluation.
elContext
,
Object
The base object whose property value is to be analyzed, or null to analyze a top-level variable.
base
,
Object
The property or variable to return the read-only status for.
property
)

Implements abstract javax.el.ELResolver.isReadOnly.

Returns true because write operations take place via the MapELResolver on the actual ELFlash instance.

public void
setValue(ELContext
The context of this evaluation.
elContext
,
Object
The base object whose property value is to be set, or null to set a top-level variable.
base
,
Object
The property or variable to be set.
property
,
Object
The value to set the property or variable to.
value
)

Implements abstract javax.el.ELResolver.setValue.

This method will throw PropertyNotWritableException if called with a null base and a property value equal to the literal string "flash".

Inherited from javax.el.ELResolver:
convertToTypeinvoke

Field Detail

FLASH_KEEP_VARIABLE_NAMEback to summary
private static final String FLASH_KEEP_VARIABLE_NAME
FLASH_NOW_VARIABLE_NAMEback to summary
private static final String FLASH_NOW_VARIABLE_NAME
FLASH_VARIABLE_NAMEback to summary
private static final String FLASH_VARIABLE_NAME

Constructor Detail

FlashELResolverback to summary
public FlashELResolver()

Not intended for manual invocation. Only called by the JSF Runtime.

Method Detail

getCommonPropertyTypeback to summary
public Class<?> getCommonPropertyType(ELContext context, Object base)

Implements abstract javax.el.ELResolver.getCommonPropertyType.

If base is non-null and is the literal string "flash", return Object.class.

Parameters
context:ELContext

Doc from javax.el.ELResolver.getCommonPropertyType.

The context of this evaluation.

base:Object

Doc from javax.el.ELResolver.getCommonPropertyType.

The base object to return the most general property type for, or null to enumerate the set of top-level variables that this resolver can evaluate.

Returns:Class<?>

Doc from javax.el.ELResolver.getCommonPropertyType.

null if this ELResolver does not know how to handle the given base object; otherwise Object.class if any type of property is accepted; otherwise the most general property type accepted for the given base.

Annotations
@Override
getFeatureDescriptorsback to summary
public Iterator<FeatureDescriptor> getFeatureDescriptors(ELContext elContext, Object base)

Implements abstract javax.el.ELResolver.getFeatureDescriptors.

Returns an iterator of FeatureDescriptors for the current contents of the flash.

Parameters
elContext:ELContext

Doc from javax.el.ELResolver.getFeatureDescriptors.

The context of this evaluation.

base:Object

Doc from javax.el.ELResolver.getFeatureDescriptors.

The base object whose set of valid properties is to be enumerated, or null to enumerate the set of top-level variables that this resolver can evaluate.

Returns:Iterator<FeatureDescriptor>

Doc from javax.el.ELResolver.getFeatureDescriptors.

An Iterator containing zero or more (possibly infinitely more) FeatureDescriptor objects, or null if this resolver does not handle the given base object or that the results are too complex to represent with this method

Annotations
@Override
getTypeback to summary
public Class<?> getType(ELContext elContext, Object base, Object property)

Implements abstract javax.el.ELResolver.getType.

Return the valid Class for a future set operation, which will always be null because sets happen via the MapELResolver operating on the ELFlash instance as a Map.

Parameters
elContext:ELContext

Doc from javax.el.ELResolver.getType.

The context of this evaluation.

base:Object

Doc from javax.el.ELResolver.getType.

The base object whose property value is to be analyzed, or null to analyze a top-level variable.

property:Object

Doc from javax.el.ELResolver.getType.

The property or variable to return the acceptable type for.

Returns:Class<?>

Doc from javax.el.ELResolver.getType.

If the propertyResolved property of ELContext was set to true, then the most general acceptable type; otherwise undefined.

Annotations
@Override
Exceptions
PropertyNotFoundException:
if property is null.
getValueback to summary
public Object getValue(ELContext elContext, Object base, Object property)

Implements abstract javax.el.ELResolver.getValue.

Hook into the EL resolution process to introduce the flash implicit object. If property is null, take no action and return null. if base is null, return null. If base is an instance of ELFlash and property is the literal string "keep", set a ThreadLocal property that will be inspected by the flash on the next link in the resolution chain and return the ELFlash instance. If base is an instance of ELFlash and property is the literal string "now", return the result of calling getRequestMap( ) on the ExternalContext for the FacesContext for this request. Call setPropertyResolved(true) on the ELContext where appropriate.

Parameters
elContext:ELContext

Doc from javax.el.ELResolver.getValue.

The context of this evaluation.

base:Object

Doc from javax.el.ELResolver.getValue.

The base object whose property value is to be returned, or null to resolve a top-level variable.

property:Object

Doc from javax.el.ELResolver.getValue.

The property or variable to be resolved.

Returns:Object

Doc from javax.el.ELResolver.getValue.

If the propertyResolved property of ELContext was set to true, then the result of the variable or property resolution; otherwise undefined.

Annotations
@Override
Exceptions
PropertyNotFoundException:
if property is null.
isReadOnlyback to summary
public boolean isReadOnly(ELContext elContext, Object base, Object property)

Implements abstract javax.el.ELResolver.isReadOnly.

Returns true because write operations take place via the MapELResolver on the actual ELFlash instance.

Parameters
elContext:ELContext

Doc from javax.el.ELResolver.isReadOnly.

The context of this evaluation.

base:Object

Doc from javax.el.ELResolver.isReadOnly.

The base object whose property value is to be analyzed, or null to analyze a top-level variable.

property:Object

Doc from javax.el.ELResolver.isReadOnly.

The property or variable to return the read-only status for.

Returns:boolean

Doc from javax.el.ELResolver.isReadOnly.

If the propertyResolved property of ELContext was set to true, then true if the property is read-only or false if not; otherwise undefined.

Annotations
@Override
Exceptions
PropertyNotFoundException:
if base is null and property is null.
setValueback to summary
public void setValue(ELContext elContext, Object base, Object property, Object value)

Implements abstract javax.el.ELResolver.setValue.

This method will throw PropertyNotWritableException if called with a null base and a property value equal to the literal string "flash". This is because set operations normally go through the MapELResolver via the ELFlash Map.

In other words, do not call this method directly to set a value into the flash! The only way to access the flash is either through JSP or via the EL API.

Parameters
elContext:ELContext

Doc from javax.el.ELResolver.setValue.

The context of this evaluation.

base:Object

Doc from javax.el.ELResolver.setValue.

The base object whose property value is to be set, or null to set a top-level variable.

property:Object

Doc from javax.el.ELResolver.setValue.

The property or variable to be set.

value:Object

Doc from javax.el.ELResolver.setValue.

The value to set the property or variable to.

Annotations
@Override
Exceptions
PropertyNotFoundException:
if base is null and property is null.
PropertyNotWritableException:
if base is null and property is the literal string "flash".