com.sun.faces.el
Class ELUtils

java.lang.Object
  extended by com.sun.faces.el.ELUtils

public class ELUtils
extends java.lang.Object

Utility class for EL related methods.


Nested Class Summary
static class ELUtils.Scope
           
 
Field Summary
static javax.el.ArrayELResolver ARRAY_RESOLVER
           
static javax.el.BeanELResolver BEAN_RESOLVER
           
static javax.el.ResourceBundleELResolver BUNDLE_RESOLVER
           
static CompositeComponentAttributesELResolver COMPOSITE_COMPONENT_ATTRIBUTES_EL_RESOLVER
           
static FacesResourceBundleELResolver FACES_BUNDLE_RESOLVER
           
static FlashELResolver FLASH_RESOLVER
           
static ImplicitObjectELResolverForJsp IMPLICIT_JSP_RESOLVER
           
static ImplicitObjectELResolver IMPLICIT_RESOLVER
           
static javax.el.ListELResolver LIST_RESOLVER
           
static ManagedBeanELResolver MANAGED_BEAN_RESOLVER
           
static javax.el.MapELResolver MAP_RESOLVER
           
static ResourceELResolver RESOURCE_RESOLVER
           
static ScopedAttributeELResolver SCOPED_RESOLVER
           
 
Method Summary
static void buildFacesResolver(FacesCompositeELResolver composite, ApplicationAssociate associate)
          Create the ELResolver chain for programmatic EL calls.
static void buildJSPResolver(FacesCompositeELResolver composite, ApplicationAssociate associate)
          Create the ELResolver chain for JSP.
static java.lang.Object coerce(java.lang.Object value, java.lang.Class<?> toType)
           
static javax.el.ValueExpression createValueExpression(java.lang.String expression)
          Create a ValueExpression with the expected type of Object.class
static javax.el.ValueExpression createValueExpression(java.lang.String expression, java.lang.Class<?> expectedType)
           
static java.lang.Object evaluateValueExpression(javax.el.ValueExpression expression, javax.el.ELContext elContext)
           
static javax.faces.el.PropertyResolver getDelegatePR(ApplicationAssociate associate, boolean provideDefault)
           
static javax.faces.el.VariableResolver getDelegateVR(ApplicationAssociate associate, boolean provideDefault)
           
static java.util.List<java.lang.String> getExpressionsFromString(java.lang.String expressionString)
           
static ELUtils.Scope getNarrowestScopeFromExpression(java.lang.String expression)
           
static ELUtils.Scope getScope(java.lang.String scope)
           
static ELUtils.Scope getScope(java.lang.String valueBinding, java.lang.String[] outString)
          This method is used by the ManagedBeanFactory to ensure that properties set by an expression point to an object with an accepted lifespan.
static ELUtils.Scope getScopeForExpression(java.lang.String expression)
           
static ELUtils.Scope getScopeForSingleExpression(java.lang.String value)
           
static boolean hasValidLifespan(ELUtils.Scope expressionScope, ELUtils.Scope beanScope)
           
static boolean isCompositeComponentExpr(java.lang.String expression)
           
static boolean isCompositeComponentLookupWithArgs(java.lang.String expression)
           
static boolean isCompositeComponentMethodExprLookup(java.lang.String expression)
           
static boolean isExpression(java.lang.String expression)
           
static boolean isMixedExpression(java.lang.String expression)
           
static boolean isScopeValid(java.lang.String scopeName)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

ARRAY_RESOLVER

public static final javax.el.ArrayELResolver ARRAY_RESOLVER

BEAN_RESOLVER

public static final javax.el.BeanELResolver BEAN_RESOLVER

FACES_BUNDLE_RESOLVER

public static final FacesResourceBundleELResolver FACES_BUNDLE_RESOLVER

IMPLICIT_JSP_RESOLVER

public static final ImplicitObjectELResolverForJsp IMPLICIT_JSP_RESOLVER

IMPLICIT_RESOLVER

public static final ImplicitObjectELResolver IMPLICIT_RESOLVER

FLASH_RESOLVER

public static final FlashELResolver FLASH_RESOLVER

LIST_RESOLVER

public static final javax.el.ListELResolver LIST_RESOLVER

MANAGED_BEAN_RESOLVER

public static final ManagedBeanELResolver MANAGED_BEAN_RESOLVER

MAP_RESOLVER

public static final javax.el.MapELResolver MAP_RESOLVER

BUNDLE_RESOLVER

public static final javax.el.ResourceBundleELResolver BUNDLE_RESOLVER

SCOPED_RESOLVER

public static final ScopedAttributeELResolver SCOPED_RESOLVER

RESOURCE_RESOLVER

public static final ResourceELResolver RESOURCE_RESOLVER

COMPOSITE_COMPONENT_ATTRIBUTES_EL_RESOLVER

public static final CompositeComponentAttributesELResolver COMPOSITE_COMPONENT_ATTRIBUTES_EL_RESOLVER
Method Detail

isCompositeComponentExpr

public static boolean isCompositeComponentExpr(java.lang.String expression)

isCompositeComponentMethodExprLookup

public static boolean isCompositeComponentMethodExprLookup(java.lang.String expression)

isCompositeComponentLookupWithArgs

public static boolean isCompositeComponentLookupWithArgs(java.lang.String expression)

buildFacesResolver

public static void buildFacesResolver(FacesCompositeELResolver composite,
                                      ApplicationAssociate associate)

Create the ELResolver chain for programmatic EL calls.

Parameters:
composite - a CompositeELResolver
associate - our ApplicationAssociate

buildJSPResolver

public static void buildJSPResolver(FacesCompositeELResolver composite,
                                    ApplicationAssociate associate)

Create the ELResolver chain for JSP.

Parameters:
composite - a CompositeELResolver
associate - our ApplicationAssociate

evaluateValueExpression

public static java.lang.Object evaluateValueExpression(javax.el.ValueExpression expression,
                                                       javax.el.ELContext elContext)

getDelegatePR

public static javax.faces.el.PropertyResolver getDelegatePR(ApplicationAssociate associate,
                                                            boolean provideDefault)
Parameters:
associate - the ApplicationAssociate
provideDefault - whether or not to return a DummpyPropertyResolverImpl
Returns:
the PropertyResolvers set via Application.setPropertyResolver(javax.faces.el.PropertyResolver) or, if that is null, return the PropertyResolver chain from the parsed configuration resources. If either of those are null, and provideDefault is true, return the DummyPropertyResolverImpl.

getDelegateVR

public static javax.faces.el.VariableResolver getDelegateVR(ApplicationAssociate associate,
                                                            boolean provideDefault)
Parameters:
associate - the ApplicationAssociate
provideDefault - whether or not to return a DummpyPropertyResolverImpl
Returns:
the VariableResolvers set via Application.setVariableResolver(javax.faces.el.VariableResolver) or, if that is null, return the VariableResolver chain from the parsed configuration resources. If either of those are null, , and provideDefault is true, return the ChainAwareVariableResolver.

getExpressionsFromString

public static java.util.List<java.lang.String> getExpressionsFromString(java.lang.String expressionString)
                                                                 throws javax.faces.el.ReferenceSyntaxException
Parameters:
expressionString - the expression string, with delimiters intact.
Returns:
a List of expressions from the expressionString
Throws:
javax.faces.el.ReferenceSyntaxException - if the expression string is invalid

getScope

public static ELUtils.Scope getScope(java.lang.String valueBinding,
                                     java.lang.String[] outString)
                              throws javax.faces.el.ReferenceSyntaxException

This method is used by the ManagedBeanFactory to ensure that properties set by an expression point to an object with an accepted lifespan.

get the scope of the expression. Return null if it isn't scoped

For example, the expression: sessionScope.TestBean.one should return "session" as the scope.

Parameters:
valueBinding - the expression
outString - an allocated String Array into which we put the first segment.
Returns:
the scope of the expression
Throws:
javax.faces.el.ReferenceSyntaxException - if valueBinding is syntactically invalid

createValueExpression

public static javax.el.ValueExpression createValueExpression(java.lang.String expression)
Create a ValueExpression with the expected type of Object.class

Parameters:
expression - an EL expression
Returns:
a new ValueExpression instance based off the provided valueRef

createValueExpression

public static javax.el.ValueExpression createValueExpression(java.lang.String expression,
                                                             java.lang.Class<?> expectedType)

coerce

public static java.lang.Object coerce(java.lang.Object value,
                                      java.lang.Class<?> toType)

getScope

public static ELUtils.Scope getScope(java.lang.String scope)

getScopeForExpression

public static ELUtils.Scope getScopeForExpression(java.lang.String expression)

hasValidLifespan

public static boolean hasValidLifespan(ELUtils.Scope expressionScope,
                                       ELUtils.Scope beanScope)
                                throws javax.faces.el.EvaluationException
Throws:
javax.faces.el.EvaluationException

getScopeForSingleExpression

public static ELUtils.Scope getScopeForSingleExpression(java.lang.String value)
                                                 throws javax.faces.el.EvaluationException
Throws:
javax.faces.el.EvaluationException

getNarrowestScopeFromExpression

public static ELUtils.Scope getNarrowestScopeFromExpression(java.lang.String expression)
                                                     throws javax.faces.el.ReferenceSyntaxException
Throws:
javax.faces.el.ReferenceSyntaxException

isMixedExpression

public static boolean isMixedExpression(java.lang.String expression)

isExpression

public static boolean isExpression(java.lang.String expression)

isScopeValid

public static boolean isScopeValid(java.lang.String scopeName)


Copyright © 2011 Oracle America, Inc. All Rights Reserved.