Top Description Fields Constructors Methods
javax.el

public Class ResourceBundleELResolver

extends ELResolver
Class Inheritance
Imports
java.beans.FeatureDescriptor, java.util.ArrayList, .Enumeration, .Iterator, .List, .MissingResourceException, .ResourceBundle

Defines property resolution behavior on instances of java.util.ResourceBundle.

This resolver handles base objects of type java.util.ResourceBundle. It accepts any object as a property and coerces it to a java.lang.String for invoking java.util.ResourceBundle#getObject(java.lang.String).

This resolver is read only and will throw a PropertyNotWritableException if setValue is called.

ELResolvers are combined together using CompositeELResolvers, to define rich semantics for evaluating an expression. See the javadocs for ELResolver for details.

Since
JSP 2.1
See Also
CompositeELResolver, ELResolver, java.util.ResourceBundle

Field Summary

Inherited from javax.el.ELResolver:
RESOLVABLE_AT_DESIGN_TIMETYPE

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public Class<?>

Returns:

null if base is not a ResourceBundle; otherwise String.class.
getCommonPropertyType
(ELContext
The context of this evaluation.
context
,
Object
The bundle to analyze. Only bases of type ResourceBundle are handled by this resolver.
base
)

Implements abstract javax.el.ELResolver.getCommonPropertyType.

If the base object is a ResourceBundle, returns the most general type that this resolver accepts for the property argument.
public Iterator<FeatureDescriptor>

Returns:

An Iterator containing zero or more (possibly infinitely more) FeatureDescriptor objects, each representing a key in this bundle, or null if the base object is not a ResourceBundle.
getFeatureDescriptors
(ELContext
The context of this evaluation.
context
,
Object
The bundle whose keys are to be iterated over. Only bases of type ResourceBundle are handled by this resolver.
base
)

Implements abstract javax.el.ELResolver.getFeatureDescriptors.

If the base object is a ResourceBundle, returns an Iterator containing the set of keys available in the ResourceBundle.
public Class<?>

Returns:

If the propertyResolved property of ELContext was set to true, then null; otherwise undefined.
getType
(ELContext
The context of this evaluation.
context
,
Object
The ResourceBundle to analyze.
base
,
Object
The name of the property to analyze.
property
)

Implements abstract javax.el.ELResolver.getType.

If the base object is an instance of ResourceBundle, return null, since the resolver is read only.
public Object

Returns:

If the propertyResolved property of ELContext was set to true, then null if property is null; otherwise the Object for the given key (property coerced to String) from the ResourceBundle. If no object for the given key can be found, then the String "???" + key + "???".
getValue
(ELContext
The context of this evaluation.
context
,
Object
The ResourceBundle to analyze.
base
,
Object
The name of the property to analyze. Will be coerced to a String.
property
)

Implements abstract javax.el.ELResolver.getValue.

If the base object is an instance of ResourceBundle, the provided property will first be coerced to a String.
public boolean

Returns:

If the propertyResolved property of ELContext was set to true, then true; otherwise undefined.
isReadOnly
(ELContext
The context of this evaluation.
context
,
Object
The ResourceBundle to be modified. Only bases that are of type ResourceBundle are handled.
base
,
Object
The String property to use.
property
)

Implements abstract javax.el.ELResolver.isReadOnly.

If the base object is not null and an instanceof ResourceBundle, return true.
public void
setValue(ELContext
The context of this evaluation.
context
,
Object
The ResourceBundle to be modified. Only bases that are of type ResourceBundle are handled.
base
,
Object
The String property to use.
property
,
Object
The value to be set.
value
)

Implements abstract javax.el.ELResolver.setValue.

If the base object is a ResourceBundle, throw a PropertyNotWritableException.
Inherited from javax.el.ELResolver:
convertToTypeinvoke

Constructor Detail

ResourceBundleELResolverback to summary
public ResourceBundleELResolver()

Method Detail

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

Implements abstract javax.el.ELResolver.getCommonPropertyType.

If the base object is a ResourceBundle, returns the most general type that this resolver accepts for the property argument. Otherwise, returns null.

Assuming the base is a ResourceBundle, this method will always return String.class.

Parameters
context:ELContext

The context of this evaluation.

base:Object

The bundle to analyze. Only bases of type ResourceBundle are handled by this resolver.

Returns:Class<?>

null if base is not a ResourceBundle; otherwise String.class.

getFeatureDescriptorsback to summary
public Iterator<FeatureDescriptor> getFeatureDescriptors(ELContext context, Object base)

Implements abstract javax.el.ELResolver.getFeatureDescriptors.

If the base object is a ResourceBundle, returns an Iterator containing the set of keys available in the ResourceBundle. Otherwise, returns null.

The Iterator returned must contain zero or more instances of java.beans.FeatureDescriptor. Each info object contains information about a key in the ResourceBundle, and is initialized as follows:

  • displayName - The String key
  • name - Same as displayName property.
  • shortDescription - Empty string
  • expert - false
  • hidden - false
  • preferred - true
  • In addition, the following named attributes must be set in the returned FeatureDescriptors:
  • ELResolver#TYPE - String.class
  • ELResolver#RESOLVABLE_AT_DESIGN_TIME - true
  • Parameters
    context:ELContext

    The context of this evaluation.

    base:Object

    The bundle whose keys are to be iterated over. Only bases of type ResourceBundle are handled by this resolver.

    Returns:Iterator<FeatureDescriptor>

    An Iterator containing zero or more (possibly infinitely more) FeatureDescriptor objects, each representing a key in this bundle, or null if the base object is not a ResourceBundle.

    getTypeback to summary
    public Class<?> getType(ELContext context, Object base, Object property)

    Implements abstract javax.el.ELResolver.getType.

    If the base object is an instance of ResourceBundle, return null, since the resolver is read only.

    If the base is ResourceBundle, the propertyResolved property of the ELContext object must be set to true by this resolver, before returning. If this property is not true after this method is called, the caller should ignore the return value.

    Parameters
    context:ELContext

    The context of this evaluation.

    base:Object

    The ResourceBundle to analyze.

    property:Object

    The name of the property to analyze.

    Returns:Class<?>

    If the propertyResolved property of ELContext was set to true, then null; otherwise undefined.

    Exceptions
    NullPointerException:
    if context is null
    getValueback to summary
    public Object getValue(ELContext context, Object base, Object property)

    Implements abstract javax.el.ELResolver.getValue.

    If the base object is an instance of ResourceBundle, the provided property will first be coerced to a String. The Object returned by getObject on the base ResourceBundle will be returned.

    If the base is ResourceBundle, the propertyResolved property of the ELContext object must be set to true by this resolver, before returning. If this property is not true after this method is called, the caller should ignore the return value.

    Parameters
    context:ELContext

    The context of this evaluation.

    base:Object

    The ResourceBundle to analyze.

    property:Object

    The name of the property to analyze. Will be coerced to a String.

    Returns:Object

    If the propertyResolved property of ELContext was set to true, then null if property is null; otherwise the Object for the given key (property coerced to String) from the ResourceBundle. If no object for the given key can be found, then the String "???" + key + "???".

    Exceptions
    NullPointerException:
    if context is null
    ELException:
    if an exception was thrown while performing the property or variable resolution. The thrown exception must be included as the cause property of this exception, if available.
    isReadOnlyback to summary
    public boolean isReadOnly(ELContext context, Object base, Object property)

    Implements abstract javax.el.ELResolver.isReadOnly.

    If the base object is not null and an instanceof ResourceBundle, return true.

    Parameters
    context:ELContext

    The context of this evaluation.

    base:Object

    The ResourceBundle to be modified. Only bases that are of type ResourceBundle are handled.

    property:Object

    The String property to use.

    Returns:boolean

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

    Exceptions
    NullPointerException:
    if context is null
    setValueback to summary
    public void setValue(ELContext context, Object base, Object property, Object value)

    Implements abstract javax.el.ELResolver.setValue.

    If the base object is a ResourceBundle, throw a PropertyNotWritableException.

    Parameters
    context:ELContext

    The context of this evaluation.

    base:Object

    The ResourceBundle to be modified. Only bases that are of type ResourceBundle are handled.

    property:Object

    The String property to use.

    value:Object

    The value to be set.

    Exceptions
    NullPointerException:
    if context is null.
    PropertyNotWritableException:
    Always thrown if base is an instance of ReasourceBundle.