javax.el
Class StandardELContext

java.lang.Object
  extended by javax.el.ELContext
      extended by javax.el.StandardELContext

public class StandardELContext
extends ELContext

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

Constructor Summary
StandardELContext(ELContext context)
          Construct a StandardELContext from another ELContext.
StandardELContext(ExpressionFactory factory)
          Construct a default ELContext for a stand-alone environment.
 
Method Summary
 void addELResolver(ELResolver cELResolver)
          Add a custom ELResolver to the context.
 java.lang.Object getContext(java.lang.Class key)
          Returns the context object associated with the given key.
 ELResolver getELResolver()
          Construct (if needed) and return a default ELResolver.
 FunctionMapper getFunctionMapper()
          Construct (if needed) and return a default FunctionMapper.
 ImportHandler getImportHandler()
          Construct (if need) and return an ImportHandler
 VariableMapper getVariableMapper()
          Construct (if needed) and return a default VariableMapper() {
 void putContext(java.lang.Class key, java.lang.Object contextObject)
          Associates a context object with this ELContext.
 
Methods inherited from class javax.el.ELContext
addEvaluationListener, convertToType, enterLambdaScope, exitLambdaScope, getEvaluationListeners, getLambdaArgument, getLocale, isLambdaArgument, isPropertyResolved, setLocale, setPropertyResolved, setPropertyResolved
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

StandardELContext

public StandardELContext(ExpressionFactory factory)
Construct a default ELContext for a stand-alone environment.

Parameters:
factory - The ExpressionFactory

StandardELContext

public StandardELContext(ELContext context)
Construct a StandardELContext from another ELContext.

Parameters:
context - The ELContext that acts as a delegate in most cases
Method Detail

putContext

public void putContext(java.lang.Class key,
                       java.lang.Object contextObject)
Description copied from class: ELContext
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.

Overrides:
putContext in class ELContext
Parameters:
key - The key used by an @{link ELResolver} to identify this context object.
contextObject - The context object to add to the collection.

getContext

public java.lang.Object getContext(java.lang.Class key)
Description copied from class: ELContext
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.

Overrides:
getContext in class ELContext
Parameters:
key - The unique identifier that was used to associate the context object with this ELContext.
Returns:
The context object associated with the given key, or null if no such context was found.

getELResolver

public ELResolver 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 implementing the Linq query operators
  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

Specified by:
getELResolver in class ELContext
Returns:
The ELResolver for this context.

addELResolver

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 - The new ELResolver to be added to the context

getImportHandler

public ImportHandler getImportHandler()
Construct (if need) and return an ImportHandler

Overrides:
getImportHandler in class ELContext
Returns:
The import handler to manage imports of classes and packages.

getFunctionMapper

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

Specified by:
getFunctionMapper in class ELContext
Returns:
The default FunctionMapper

getVariableMapper

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

Specified by:
getVariableMapper in class ELContext
Returns:
The default Variable


Copyright (c) 1999-2012 Oracle and/or its affiliates. All Rights Reserved. Use is subject to license terms.