Top Description Fields Constructors Methods
javax.el

public Class StaticFieldELResolver

extends ELResolver
Class Inheritance
Imports
java.util.Iterator, java.lang.reflect.Field, .Method, .Modifier, .Constructor, java.beans.FeatureDescriptor

An ELResolver for resolving static fields, enum constants and static methods. Also handles constructor calls as a special case.

The resolver handles base objects of the type ELClass, which is usually generated by an EL implementation.

Since
EL 3.0
See Also
ELClass

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:

String.class.
getCommonPropertyType
(ELContext
The context of this evaluation.
context
,
Object
An ELClass.
base
)

Implements abstract javax.el.ELResolver.getCommonPropertyType.

Returns the type of the property.
public Iterator<FeatureDescriptor>

Returns:

null.
getFeatureDescriptors
(ELContext
The context of this evaluation.
context
,
Object
An ELClass.
base
)

Implements abstract javax.el.ELResolver.getFeatureDescriptors.

Returns the properties that can be resolved.
public Class<?>

Returns:

If the propertyResolved property of ELContext was set to true, then the type of the type of the field.
getType
(ELContext
The context of this evaluation.
context
,
Object
An ELClass.
base
,
Object
The name of the field.
property
)

Implements abstract javax.el.ELResolver.getType.

Returns the type of a static field.

public Object

Returns:

If the propertyResolved property of ELContext was set to true, then the static field value.
getValue
(ELContext
The context of this evaluation.
context
,
Object
An ELClass.
base
,
Object
A static field name.
property
)

Implements abstract javax.el.ELResolver.getValue.

Returns the value of a static field.

public Object

Returns:

The result of the method invocation (null if the method has a void return type).
invoke
(ELContext
The context of this evaluation.
context
,
Object
An ELClass
base
,
Object
When coerced to a String, the simple name of the method.
method
,
Class<?>[]
An array of Class objects identifying the method's formal parameter types, in declared order. Use an empty array if the method has no parameters. Can be null, in which case the method's formal parameter types are assumed to be unknown.
paramTypes
,
Object[]
The parameters to pass to the method, or null if no parameters.
params
)

Overrides javax.el.ELResolver.invoke.

Invokes a public static method or the constructor for a class.

public boolean

Returns:

true
isReadOnly
(ELContext
The context of this evaluation.
context
,
Object
An ELClass.
base
,
Object
The name of the bean.
property
)

Implements abstract javax.el.ELResolver.isReadOnly.

Inquires whether the static field is writable.

public void
setValue(ELContext
The context of this evaluation.
context
,
Object
An ELClass
base
,
Object
The name of the field
property
,
Object
The value to set the field of the class to.
value
)

Implements abstract javax.el.ELResolver.setValue.

Attempts to write to a static field.

Inherited from javax.el.ELResolver:
convertToType

Constructor Detail

StaticFieldELResolverback to summary
public StaticFieldELResolver()

Method Detail

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

Implements abstract javax.el.ELResolver.getCommonPropertyType.

Returns the type of the property. Always returns String.class, since a field name is a String.

Parameters
context:ELContext

The context of this evaluation.

base:Object

An ELClass.

Returns:Class<?>

String.class.

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

Implements abstract javax.el.ELResolver.getFeatureDescriptors.

Returns the properties that can be resolved. Always returns null, since there is no reason to iterate through a list of one element: field name.

Parameters
context:ELContext

The context of this evaluation.

base:Object

An ELClass.

Returns:Iterator<FeatureDescriptor>

null.

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

Implements abstract javax.el.ELResolver.getType.

Returns the type of a static field.

If the base object is an instance of ELClassand the property is a String, the propertyResolved property of the ELContext object must be set to true by the resolver, before returning. If this property is not true after this method is called, the caller can safely assume no value has been set.

If the property string is a public static field of class specified in ELClass, return the type of the static field.

Parameters
context:ELContext

The context of this evaluation.

base:Object

An ELClass.

property:Object

The name of the field.

Returns:Class<?>

If the propertyResolved property of ELContext was set to true, then the type of the type of the field.

Annotations
@Override
Exceptions
NullPointerException:
if context is null.
PropertyNotFoundException:
if field is not a public static filed of the class, or if the field is inaccessible.
getValueback to summary
public Object getValue(ELContext context, Object base, Object property)

Implements abstract javax.el.ELResolver.getValue.

Returns the value of a static field.

If the base object is an instance of ELClass and the property is String, 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.

If the property is a public static field of class specified in ELClass, return the value of the static field. An Enum constant is a public static field of an Enum object, and is a special case of this.
Parameters
context:ELContext

The context of this evaluation.

base:Object

An ELClass.

property:Object

A static field name.

Returns:Object

If the propertyResolved property of ELContext was set to true, then the static field value.

Annotations
@Override
Exceptions
NullPointerException:
if context is null.
PropertyNotFoundException:
if the specified class does not exist, or if the field is not a public static filed of the class, or if the field is inaccessible.
invokeback to summary
public Object invoke(ELContext context, Object base, Object method, Class<?>[] paramTypes, Object[] params)

Overrides javax.el.ELResolver.invoke.

Invokes a public static method or the constructor for a class.

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

Invoke the public static method specified by method.

The process involved in the method selection is the same as that used in BeanELResolver.

As a special case, if the name of the method is "<init>", the constructor for the class will be invoked.

Parameters
context:ELContext

Doc from javax.el.ELResolver.invoke.

The context of this evaluation.

base:Object

An ELClass

method:Object

When coerced to a String, the simple name of the method.

paramTypes:Class<?>[]

An array of Class objects identifying the method's formal parameter types, in declared order. Use an empty array if the method has no parameters. Can be null, in which case the method's formal parameter types are assumed to be unknown.

params:Object[]

The parameters to pass to the method, or null if no parameters.

Returns:Object

The result of the method invocation (null if the method has a void return type).

Annotations
@Override
Exceptions
MethodNotFoundException:
if no suitable method can be found.
ELException:
if an exception was thrown while performing (base, method) resolution. The thrown exception must be included as the cause property of this exception, if available. If the exception thrown is an InvocationTargetException, extract its cause and pass it to the ELException constructor.
isReadOnlyback to summary
public boolean isReadOnly(ELContext context, Object base, Object property)

Implements abstract javax.el.ELResolver.isReadOnly.

Inquires whether the static field is writable.

If the base object is an instance of ELClassand the property is a String, the propertyResolved property of the ELContext object must be set to true by the resolver, before returning. If this property is not true after this method is called, the caller can safely assume no value has been set.

Always returns a true because writing to a static field is not allowed.

Parameters
context:ELContext

The context of this evaluation.

base:Object

An ELClass.

property:Object

The name of the bean.

Returns:boolean

true

Annotations
@Override
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.

Attempts to write to a static field.

If the base object is an instance of ELClassand the property is String, a PropertyNotWritableException will always be thrown, because writing to a static field is not allowed.

Parameters
context:ELContext

The context of this evaluation.

base:Object

An ELClass

property:Object

The name of the field

value:Object

The value to set the field of the class to.

Annotations
@Override
Exceptions
NullPointerException:
if context is null
PropertyNotWritableException:

Doc from javax.el.ELResolver.setValue.

if the given (base, property) pair is handled by this ELResolver but the specified variable or property is not writable.