Top Description Inners Fields Constructors Methods
javax.el

public Class StandardELContext

extends ELContext
Class Inheritance
Imports
java.util.Map, .HashMap, java.lang.reflect.Method

A standard ELContext suitable for use in a stand alone environment. This class provides a default implementation of an ELResolver that contains a number of useful ELResolvers. It also provides local repositories for the FunctionMapper, VariableMapper, and BeanNameResolver.
Since
EL 3.0

Nested and Inner Type Summary

Modifier and TypeClass and Description
private static class
private static class
private class

Field Summary

Modifier and TypeField and Description
private Map<String, Object>
beans

A bean repository local to this context

private CompositeELResolver
private ELContext
private ELResolver
private FunctionMapper
private Map<String, Method>
private ELResolver
private VariableMapper

Constructor Summary

AccessConstructor and Description
public
StandardELContext(ExpressionFactory
The ExpressionFactory
factory
)

Construct a default ELContext for a stand-alone environment.

public
StandardELContext(ELContext
The ELContext that acts as a delegate in most cases
context
)

Construct a StandardELContext from another ELContext.

Method Summary

Modifier and TypeMethod and Description
public void
addELResolver(ELResolver
The new ELResolver to be added to the context
cELResolver
)

Add a custom ELResolver to the context.

pack-priv Map<String, Object>

Returns:

the bean repository
getBeans
()

Get the local bean repository

public Object
getContext(Class<T>
The unique identifier that was used to associate the context object with this ELContext.
key
)

Overrides javax.el.ELContext.getContext.

Returns the context object associated with the given key.
public ELResolver

Returns:

The ELResolver for this context.
getELResolver
()

Implements abstract javax.el.ELContext.getELResolver.

Construct (if needed) and return a default ELResolver.
public FunctionMapper

Returns:

The default FunctionMapper
getFunctionMapper
()

Implements abstract javax.el.ELContext.getFunctionMapper.

Construct (if needed) and return a default FunctionMapper.
public VariableMapper

Returns:

The default Variable
getVariableMapper
()

Implements abstract javax.el.ELContext.getVariableMapper.

Construct (if needed) and return a default VariableMapper() {
public void
putContext(Class<T>
The key used by an @{link ELResolver} to identify this context object.
key
,
Object
The context object to add to the collection.
contextObject
)

Overrides javax.el.ELContext.putContext.

Associates a context object with this ELContext.
Inherited from javax.el.ELContext:
addEvaluationListenerconvertToTypeenterLambdaScopeexitLambdaScopegetEvaluationListenersgetImportHandlergetLambdaArgumentgetLocaleisLambdaArgumentisPropertyResolvednotifyAfterEvaluationnotifyBeforeEvaluationnotifyPropertyResolvedsetLocalesetPropertyResolvedsetPropertyResolved

Field Detail

beansback to summary
private Map<String, Object> beans

A bean repository local to this context

customResolversback to summary
private CompositeELResolver customResolvers
delegateback to summary
private ELContext delegate
elResolverback to summary
private ELResolver elResolver
functionMapperback to summary
private FunctionMapper functionMapper
initFunctionMapback to summary
private Map<String, Method> initFunctionMap
streamELResolverback to summary
private ELResolver streamELResolver
variableMapperback to summary
private VariableMapper variableMapper

Constructor Detail

StandardELContextback to summary
public StandardELContext(ExpressionFactory factory)

Construct a default ELContext for a stand-alone environment.

Parameters
factory:ExpressionFactory

The ExpressionFactory

StandardELContextback to summary
public StandardELContext(ELContext context)

Construct a StandardELContext from another ELContext.

Parameters
context:ELContext

The ELContext that acts as a delegate in most cases

Method Detail

addELResolverback to summary
public void addELResolver(ELResolver cELResolver)

Add a custom ELResolver to the context. The list of the custom ELResolvers will be accessed in the order they are added. A custom ELResolver added to the context cannot be removed.

Parameters
cELResolver:ELResolver

The new ELResolver to be added to the context

getBeansback to summary
pack-priv Map<String, Object> getBeans()

Get the local bean repository

Returns:Map<String, Object>

the bean repository

getContextback to summary
public Object getContext(Class<T> key)

Overrides javax.el.ELContext.getContext.

Doc from javax.el.ELContext.getContext.

Returns the context object associated with the given key.

The ELContext maintains a collection of context objects relevant to the evaluation of an expression. These context objects are used by ELResolvers. This method is used to retrieve the context with the given key from the collection.

By convention, the object returned will be of the type specified by the key. However, this is not required and the key is used strictly as a unique identifier.

Parameters
key:Class<T>

The unique identifier that was used to associate the context object with this ELContext.

Returns:Object

The context object associated with the given key, or null if no such context was found.

Annotations
@Override
getELResolverback to summary
public ELResolver getELResolver()

Implements abstract javax.el.ELContext.getELResolver.

Construct (if needed) and return a default ELResolver.

Retrieves the ELResolver associated with this context. This is a CompositeELResover consists of an ordered list of ELResolvers.

  1. A BeanNameELResolver for beans defined locally
  2. Any custom ELResolvers
  3. An ELResolver supporting the collection operations
  4. A StaticFieldELResolver for resolving static fields
  5. A MapELResolver for resolving Map properties
  6. A ResourceBundleELResolver for resolving ResourceBundle properties
  7. A ListELResolver for resolving List properties
  8. An ArrayELResolver for resolving array properties
  9. A BeanELResolver for resolving bean properties

Returns:ELResolver

The ELResolver for this context.

Annotations
@Override
getFunctionMapperback to summary
public FunctionMapper getFunctionMapper()

Implements abstract javax.el.ELContext.getFunctionMapper.

Construct (if needed) and return a default FunctionMapper.

Returns:FunctionMapper

The default FunctionMapper

Annotations
@Override
getVariableMapperback to summary
public VariableMapper getVariableMapper()

Implements abstract javax.el.ELContext.getVariableMapper.

Construct (if needed) and return a default VariableMapper() {

Returns:VariableMapper

The default Variable

Annotations
@Override
putContextback to summary
public void putContext(Class<T> key, Object contextObject)

Overrides javax.el.ELContext.putContext.

Doc from javax.el.ELContext.putContext.

Associates a context object with this ELContext.

The ELContext maintains a collection of context objects relevant to the evaluation of an expression. These context objects are used by ELResolvers. This method is used to add a context object to that collection.

By convention, the contextObject will be of the type specified by the key. However, this is not required and the key is used strictly as a unique identifier.

Parameters
key:Class<T>

The key used by an @{link ELResolver} to identify this context object.

contextObject:Object

The context object to add to the collection.

Annotations
@Override
javax.el back to summary

private Class StandardELContext.DefaultFunctionMapper

extends FunctionMapper
Class Inheritance

Field Summary

Modifier and TypeField and Description
private Map<String, Method>

Constructor Summary

AccessConstructor and Description
pack-priv

Method Summary

Modifier and TypeMethod and Description
public void
mapFunction(String
the prefix of the function, or "" if no prefix. For example, "fn" in ${fn:method()}, or "" in ${method()}.
prefix
,
String
the short name of the function. For example, "method" in ${fn:method()}.
localName
,
Method
The static method that is to be invoked, when the function is referenced. The null value causes the function to be removed from the map.
meth
)

Overrides javax.el.FunctionMapper.mapFunction.

Adds a static method that can be used as a function.
public Method
resolveFunction(String
the prefix of the function, or "" if no prefix. For example, "fn" in ${fn:method()}, or "" in ${method()}.
prefix
,
String
the short name of the function. For example, "method" in ${fn:method()}.
localName
)

Implements abstract javax.el.FunctionMapper.resolveFunction.

Resolves the specified prefix and local name into a java.lang.Method.

Field Detail

functionsback to summary
private Map<String, Method> functions

Constructor Detail

DefaultFunctionMapperback to summary
pack-priv DefaultFunctionMapper(Map<String, Method> initMap)

Method Detail

mapFunctionback to summary
public void mapFunction(String prefix, String localName, Method meth)

Overrides javax.el.FunctionMapper.mapFunction.

Doc from javax.el.FunctionMapper.mapFunction.

Adds a static method that can be used as a function.

Parameters
prefix:String

the prefix of the function, or "" if no prefix. For example, "fn" in ${fn:method()}, or "" in ${method()}.

localName:String

the short name of the function. For example, "method" in ${fn:method()}.

meth:Method

The static method that is to be invoked, when the function is referenced. The null value causes the function to be removed from the map.

Annotations
@Override
resolveFunctionback to summary
public Method resolveFunction(String prefix, String localName)

Implements abstract javax.el.FunctionMapper.resolveFunction.

Doc from javax.el.FunctionMapper.resolveFunction.

Resolves the specified prefix and local name into a java.lang.Method.

Returns null if no function could be found that matches the given prefix and local name.

Parameters
prefix:String

the prefix of the function, or "" if no prefix. For example, "fn" in ${fn:method()}, or "" in ${method()}.

localName:String

the short name of the function. For example, "method" in ${fn:method()}.

Returns:Method

the static method to invoke, or null if no match was found.

Annotations
@Override
javax.el back to summary

private Class StandardELContext.DefaultVariableMapper

extends VariableMapper
Class Inheritance

Field Summary

Modifier and TypeField and Description
private Map<String, ValueExpression>

Constructor Summary

AccessConstructor and Description
private

Method Summary

Modifier and TypeMethod and Description
public ValueExpression
resolveVariable(String
The variable name
variable
)

Implements abstract javax.el.VariableMapper.resolveVariable.

public ValueExpression
setVariable(String
The variable name
variable
,
ValueExpression
The ValueExpression to be assigned to the variable.
expression
)

Implements abstract javax.el.VariableMapper.setVariable.

Assign a ValueExpression to an EL variable, replacing any previously assignment to the same variable.

Field Detail

variablesback to summary
private Map<String, ValueExpression> variables

Constructor Detail

DefaultVariableMapperback to summary
private DefaultVariableMapper()

Method Detail

resolveVariableback to summary
public ValueExpression resolveVariable(String variable)

Implements abstract javax.el.VariableMapper.resolveVariable.

Parameters
variable:String

Doc from javax.el.VariableMapper.resolveVariable.

The variable name

Returns:ValueExpression

Doc from javax.el.VariableMapper.resolveVariable.

the ValueExpression assigned to the variable, null if there is no previous assignment to this variable.

Annotations
@Override
setVariableback to summary
public ValueExpression setVariable(String variable, ValueExpression expression)

Implements abstract javax.el.VariableMapper.setVariable.

Doc from javax.el.VariableMapper.setVariable.

Assign a ValueExpression to an EL variable, replacing any previously assignment to the same variable. The assignment for the variable is removed if the expression is null.

Parameters
variable:String

The variable name

expression:ValueExpression

The ValueExpression to be assigned to the variable.

Returns:ValueExpression

The previous ValueExpression assigned to this variable, null if there is no previous assignment to this variable.

Annotations
@Override
javax.el back to summary

private Class StandardELContext.LocalBeanNameResolver

extends BeanNameResolver
Class Inheritance

Constructor Summary

AccessConstructor and Description
private

Method Summary

Modifier and TypeMethod and Description
public boolean
canCreateBean(String
The name of the bean
beanName
)

Overrides javax.el.BeanNameResolver.canCreateBean.

Allow creating a bean of the given name if it does not exist.
public Object
getBean(String
The name of the bean.
beanName
)

Overrides javax.el.BeanNameResolver.getBean.

Returns the bean known by its name.
public boolean
isNameResolved(String
The name of the bean.
beanName
)

Overrides javax.el.BeanNameResolver.isNameResolved.

Returns whether the given name is resolved by the BeanNameResolver
public boolean
isReadOnly(String
The name of the bean
beanName
)

Overrides javax.el.BeanNameResolver.isReadOnly.

Indicates if the bean of the given name is read-only or writable
public void
setBeanValue(String
The name of the bean
beanName
,
Object
The value to set the bean to. Can be null.
value
)

Overrides javax.el.BeanNameResolver.setBeanValue.

Sets a value to a bean of the given name.

Constructor Detail

LocalBeanNameResolverback to summary
private LocalBeanNameResolver()

Method Detail

canCreateBeanback to summary
public boolean canCreateBean(String beanName)

Overrides javax.el.BeanNameResolver.canCreateBean.

Doc from javax.el.BeanNameResolver.canCreateBean.

Allow creating a bean of the given name if it does not exist.

Parameters
beanName:String

The name of the bean

Returns:boolean

true if bean creation is supported false otherwise.

Annotations
@Override
getBeanback to summary
public Object getBean(String beanName)

Overrides javax.el.BeanNameResolver.getBean.

Doc from javax.el.BeanNameResolver.getBean.

Returns the bean known by its name.

Parameters
beanName:String

The name of the bean.

Returns:Object

The bean with the given name. Can be null.

Annotations
@Override
isNameResolvedback to summary
public boolean isNameResolved(String beanName)

Overrides javax.el.BeanNameResolver.isNameResolved.

Doc from javax.el.BeanNameResolver.isNameResolved.

Returns whether the given name is resolved by the BeanNameResolver

Parameters
beanName:String

The name of the bean.

Returns:boolean

true if the name is resolved by this BeanNameResolver; false otherwise.

Annotations
@Override
isReadOnlyback to summary
public boolean isReadOnly(String beanName)

Overrides javax.el.BeanNameResolver.isReadOnly.

Doc from javax.el.BeanNameResolver.isReadOnly.

Indicates if the bean of the given name is read-only or writable

Parameters
beanName:String

The name of the bean

Returns:boolean

true if the bean can be set to a new value. false otherwise.

Annotations
@Override
setBeanValueback to summary
public void setBeanValue(String beanName, Object value)

Overrides javax.el.BeanNameResolver.setBeanValue.

Doc from javax.el.BeanNameResolver.setBeanValue.

Sets a value to a bean of the given name. If the bean of the given name does not exist and if canCreateBean is true, one is created with the given value.

Parameters
beanName:String

The name of the bean

value:Object

The value to set the bean to. Can be null.

Annotations
@Override