Top Description Inners Fields Constructors Methods
com.sun.faces.el

public Class ELUtils

extends Object
Class Inheritance
Static Imports
com.sun.faces.RIConstants.EMPTY_CLASS_ARGS, com.sun.faces.cdi.CdiUtils.getBeanReference, com.sun.faces.el.FacesCompositeELResolver.ELResolverChainType.Faces, .FacesCompositeELResolver.ELResolverChainType.JSP, com.sun.faces.util.MessageUtils.NULL_PARAMETERS_ERROR_MESSAGE_ID, .MessageUtils.getExceptionMessageString, .ReflectionUtils.lookupMethod, .ReflectionUtils.newInstance, .Util.getCdiBeanManager, .Util.getFacesConfigXmlVersion, .Util.getWebXmlVersion

Utility class for EL related methods.

Nested and Inner Type Summary

Modifier and TypeClass and Description
public static enum

Field Summary

Modifier and TypeField and Description
private static final String
public static final ArrayELResolver
public static final BeanELResolver
public static final ResourceBundleELResolver
public static final CompositeComponentAttributesELResolver
private static final Pattern
COMPOSITE_COMPONENT_EXPRESSION

Helps to determine if a EL expression represents a composite component EL expression.

private static final Pattern
COMPOSITE_COMPONENT_LOOKUP_WITH_ARGS

Used to determine if EL method arguments are being passed to a composite component lookup expression.

public static final FacesResourceBundleELResolver
private static final String
public static final FlashELResolver
private static final String
private static final String
public static final ImplicitObjectELResolverForJsp
public static final ImplicitObjectELResolver
private static final String
public static final ListELResolver
public static final ManagedBeanELResolver
public static final MapELResolver
private static final Pattern
METHOD_EXPRESSION_LOOKUP

Use to determine if an expression being considered as a MethodExpression is a simple lookup (i.e. #{cc.attrs.myaction}).

private static final String
private static final String
private static final String
public static final ResourceELResolver
public static final ScopedAttributeELResolver
private static final String
private static final String
private static final String

Constructor Summary

AccessConstructor and Description
private

Method Summary

Modifier and TypeMethod and Description
private static void
private static void
addELResolvers(CompositeELResolver
the CompositeELResolver to which the ELResolvers will be added.
target
,
List<ELResolver>
a List of ELResolvers
resolvers
)

Add the ELResolvers from the provided list to the target CompositeELResolver.

private static void
addPropertyResolvers(CompositeELResolver
the CompositeELResolver to which the PropertyResolvers will be added.
target
,
ApplicationAssociate
our ApplicationAssociate
associate
)

Add any PropertyResolvers to the specified CompositeELResolver.

private static void
addVariableResolvers(FacesCompositeELResolver
the CompositeELResolver to which the VariableResolvers will be added.
target
,
FacesCompositeELResolver.ELResolverChainType chainType, ApplicationAssociate
our ApplicationAssociate
associate
)

Add any VariableResolvers to the specified CompositeELResolver.

public static void
buildFacesResolver(FacesCompositeELResolver
a CompositeELResolver
composite
,
ApplicationAssociate
our ApplicationAssociate
associate
)

Create the ELResolver chain for programmatic EL calls.

public static void
buildJSPResolver(FacesCompositeELResolver
a CompositeELResolver
composite
,
ApplicationAssociate
our ApplicationAssociate
associate
)

Create the ELResolver chain for JSP.

private static void
public static Object
coerce(Object value, Class<?> toType)

public static ValueExpression

Returns:

a new ValueExpression instance based off the provided valueRef
createValueExpression
(String
an EL expression
expression
)

Create a ValueExpression with the expected type of Object.class

public static ValueExpression
createValueExpression(String expression, Class<?> expectedType)

public static Object
public static ExpressionFactory
public static ExpressionFactory
public static PropertyResolver

Returns:

the PropertyResolvers set via javax.faces.application.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.
getDelegatePR
(ApplicationAssociate
the ApplicationAssociate
associate
,
boolean
whether or not to return a DummpyPropertyResolverImpl
provideDefault
)

Deprecated as a consequence of PropertyResolver being deprecated.
public static VariableResolver

Returns:

the VariableResolvers set via javax.faces.application.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.
getDelegateVR
(ApplicationAssociate
the ApplicationAssociate
associate
,
boolean
whether or not to return a DummpyPropertyResolverImpl
provideDefault
)

Deprecated as a consequence of VariableResolver being deprecated.
public static List<String>

Returns:

a List of expressions from the expressionString
getExpressionsFromString
(String
the expression string, with delimiters intact.
expressionString
)

private static int

Returns:

index of the first occurrence of . or [
getFirstSegmentIndex
(String
the expression from which the first segment will be obtained
valueBinding
)

The the first segment of a String tokenized by a "." or "["

public static ELUtils.Scope
public static ELUtils.Scope

Returns:

the scope of the expression
getScope
(String
the expression
valueBinding
,
String[]
an allocated String Array into which we put the first segment.
outString
)

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

public static ELUtils.Scope
public static ELUtils.Scope
public static ELUtils.Scope
public static boolean
hasValidLifespan(ELUtils.Scope expressionScope, ELUtils.Scope beanScope)

public static boolean
public static boolean
public static boolean
public static boolean
isScopeValid(String scopeName)

private static String
private static boolean
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

APPLICATION_SCOPEback to summary
private static final String APPLICATION_SCOPE
ARRAY_RESOLVERback to summary
public static final ArrayELResolver ARRAY_RESOLVER
BEAN_RESOLVERback to summary
public static final BeanELResolver BEAN_RESOLVER
BUNDLE_RESOLVERback to summary
public static final ResourceBundleELResolver BUNDLE_RESOLVER
COMPOSITE_COMPONENT_ATTRIBUTES_EL_RESOLVERback to summary
public static final CompositeComponentAttributesELResolver COMPOSITE_COMPONENT_ATTRIBUTES_EL_RESOLVER
COMPOSITE_COMPONENT_EXPRESSIONback to summary
private static final Pattern COMPOSITE_COMPONENT_EXPRESSION

Helps to determine if a EL expression represents a composite component EL expression.

COMPOSITE_COMPONENT_LOOKUP_WITH_ARGSback to summary
private static final Pattern COMPOSITE_COMPONENT_LOOKUP_WITH_ARGS

Used to determine if EL method arguments are being passed to a composite component lookup expression. For example: #{cc.attrs.label('foo')} is illegal, while: #{cc.attrs.bean.label('foo')} is legal.

FACES_BUNDLE_RESOLVERback to summary
public static final FacesResourceBundleELResolver FACES_BUNDLE_RESOLVER
FACES_CONTEXT_IMPLICIT_OBJback to summary
private static final String FACES_CONTEXT_IMPLICIT_OBJ
FLASH_RESOLVERback to summary
public static final FlashELResolver FLASH_RESOLVER
HEADER_IMPLICIT_OBJback to summary
private static final String HEADER_IMPLICIT_OBJ
HEADER_VALUES_IMPLICIT_OBJback to summary
private static final String HEADER_VALUES_IMPLICIT_OBJ
IMPLICIT_JSP_RESOLVERback to summary
public static final ImplicitObjectELResolverForJsp IMPLICIT_JSP_RESOLVER
IMPLICIT_RESOLVERback to summary
public static final ImplicitObjectELResolver IMPLICIT_RESOLVER
INIT_PARAM_IMPLICIT_OBJback to summary
private static final String INIT_PARAM_IMPLICIT_OBJ
LIST_RESOLVERback to summary
public static final ListELResolver LIST_RESOLVER
MANAGED_BEAN_RESOLVERback to summary
public static final ManagedBeanELResolver MANAGED_BEAN_RESOLVER
MAP_RESOLVERback to summary
public static final MapELResolver MAP_RESOLVER
METHOD_EXPRESSION_LOOKUPback to summary
private static final Pattern METHOD_EXPRESSION_LOOKUP

Use to determine if an expression being considered as a MethodExpression is a simple lookup (i.e. #{cc.attrs.myaction}).

PARAM_IMPLICIT_OBJback to summary
private static final String PARAM_IMPLICIT_OBJ
PARAM_VALUES_IMPLICIT_OBJback to summary
private static final String PARAM_VALUES_IMPLICIT_OBJ
REQUEST_SCOPEback to summary
private static final String REQUEST_SCOPE
RESOURCE_RESOLVERback to summary
public static final ResourceELResolver RESOURCE_RESOLVER
SCOPED_RESOLVERback to summary
public static final ScopedAttributeELResolver SCOPED_RESOLVER
SESSION_SCOPEback to summary
private static final String SESSION_SCOPE
VIEW_IMPLICIT_OBJback to summary
private static final String VIEW_IMPLICIT_OBJ
VIEW_SCOPEback to summary
private static final String VIEW_SCOPE

Constructor Detail

ELUtilsback to summary
private ELUtils()

Method Detail

addEL3_0_Resolversback to summary
private static void addEL3_0_Resolvers(FacesCompositeELResolver composite, ApplicationAssociate associate)
addELResolversback to summary
private static void addELResolvers(CompositeELResolver target, List<ELResolver> resolvers)

Add the ELResolvers from the provided list to the target CompositeELResolver.

Parameters
target:CompositeELResolver

the CompositeELResolver to which the ELResolvers will be added.

resolvers:List<ELResolver>

a List of ELResolvers

addPropertyResolversback to summary
private static void addPropertyResolvers(CompositeELResolver target, ApplicationAssociate associate)

Add any PropertyResolvers to the specified CompositeELResolver.

Parameters
target:CompositeELResolver

the CompositeELResolver to which the PropertyResolvers will be added.

associate:ApplicationAssociate

our ApplicationAssociate

Annotations
@SuppressWarnings:deprecation
addVariableResolversback to summary
private static void addVariableResolvers(FacesCompositeELResolver target, FacesCompositeELResolver.ELResolverChainType chainType, ApplicationAssociate associate)

Add any VariableResolvers to the specified CompositeELResolver.

Parameters
target:FacesCompositeELResolver

the CompositeELResolver to which the VariableResolvers will be added.

associate:ApplicationAssociate

our ApplicationAssociate

Annotations
@SuppressWarnings:deprecation
buildFacesResolverback to summary
public static void buildFacesResolver(FacesCompositeELResolver composite, ApplicationAssociate associate)

Create the ELResolver chain for programmatic EL calls.

Parameters
composite:FacesCompositeELResolver

a CompositeELResolver

associate:ApplicationAssociate

our ApplicationAssociate

buildJSPResolverback to summary
public static void buildJSPResolver(FacesCompositeELResolver composite, ApplicationAssociate associate)

Create the ELResolver chain for JSP.

Parameters
composite:FacesCompositeELResolver

a CompositeELResolver

associate:ApplicationAssociate

our ApplicationAssociate

checkNotNullback to summary
private static void checkNotNull(FacesCompositeELResolver composite, ApplicationAssociate associate)
coerceback to summary
public static Object coerce(Object value, Class<?> toType)
createValueExpressionback to summary
public static ValueExpression createValueExpression(String expression)

Create a ValueExpression with the expected type of Object.class

Parameters
expression:String

an EL expression

Returns:ValueExpression

a new ValueExpression instance based off the provided valueRef

createValueExpressionback to summary
public static ValueExpression createValueExpression(String expression, Class<?> expectedType)
evaluateValueExpressionback to summary
public static Object evaluateValueExpression(ValueExpression expression, ELContext elContext)
getDefaultExpressionFactoryback to summary
public static ExpressionFactory getDefaultExpressionFactory(FacesContext facesContext)
getDefaultExpressionFactoryback to summary
public static ExpressionFactory getDefaultExpressionFactory(ApplicationAssociate associate, FacesContext facesContext)
getDelegatePRback to summary
public static PropertyResolver getDelegatePR(ApplicationAssociate associate, boolean provideDefault)

Deprecated

as a consequence of PropertyResolver being deprecated. See corresponding docs for further information.

Parameters
associate:ApplicationAssociate

the ApplicationAssociate

provideDefault:boolean

whether or not to return a DummpyPropertyResolverImpl

Returns:PropertyResolver

the PropertyResolvers set via javax.faces.application.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.

Annotations
@SuppressWarnings:deprecation
getDelegateVRback to summary
public static VariableResolver getDelegateVR(ApplicationAssociate associate, boolean provideDefault)

Deprecated

as a consequence of VariableResolver being deprecated. See corresponding docs for further information.

Parameters
associate:ApplicationAssociate

the ApplicationAssociate

provideDefault:boolean

whether or not to return a DummpyPropertyResolverImpl

Returns:VariableResolver

the VariableResolvers set via javax.faces.application.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.

Annotations
@SuppressWarnings:deprecation
getExpressionsFromStringback to summary
public static List<String> getExpressionsFromString(String expressionString) throws ReferenceSyntaxException
Parameters
expressionString:String

the expression string, with delimiters intact.

Returns:List<String>

a List of expressions from the expressionString

Annotations
@SuppressWarnings:deprecation
Exceptions
ReferenceSyntaxException:
if the expression string is invalid
getFirstSegmentIndexback to summary
private static int getFirstSegmentIndex(String valueBinding)

The the first segment of a String tokenized by a "." or "["

Parameters
valueBinding:String

the expression from which the first segment will be obtained

Returns:int

index of the first occurrence of . or [

getNarrowestScopeFromExpressionback to summary
public static ELUtils.Scope getNarrowestScopeFromExpression(String expression) throws ReferenceSyntaxException
Annotations
@SuppressWarnings:deprecation
getScopeback to summary
public static ELUtils.Scope getScope(String valueBinding, String[] outString) throws 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:String

the expression

outString:String[]

an allocated String Array into which we put the first segment.

Returns:ELUtils.Scope

the scope of the expression

Annotations
@SuppressWarnings:deprecation
Exceptions
ReferenceSyntaxException:
if valueBinding is syntactically invalid
getScopeback to summary
public static ELUtils.Scope getScope(String scope)
getScopeForExpressionback to summary
public static ELUtils.Scope getScopeForExpression(String expression)
getScopeForSingleExpressionback to summary
public static ELUtils.Scope getScopeForSingleExpression(String value) throws EvaluationException
Annotations
@SuppressWarnings:deprecation
hasValidLifespanback to summary
public static boolean hasValidLifespan(ELUtils.Scope expressionScope, ELUtils.Scope beanScope) throws EvaluationException
Annotations
@SuppressWarnings:deprecation
isCompositeComponentExprback to summary
public static boolean isCompositeComponentExpr(String expression)
isCompositeComponentLookupWithArgsback to summary
public static boolean isCompositeComponentLookupWithArgs(String expression)
isCompositeComponentMethodExprLookupback to summary
public static boolean isCompositeComponentMethodExprLookup(String expression)
isScopeValidback to summary
public static boolean isScopeValid(String scopeName)
stripBracketsIfNecessaryback to summary
private static String stripBracketsIfNecessary(String expression) throws ReferenceSyntaxException
Annotations
@SuppressWarnings:deprecation
tryAddCDIELResolverback to summary
private static boolean tryAddCDIELResolver(FacesCompositeELResolver composite)
com.sun.faces.el back to summary

public final Enum ELUtils.Scope

extends Enum<ELUtils.Scope>
Class Inheritance

Field Summary

Modifier and TypeField and Description
public static final ELUtils.Scope
public static final ELUtils.Scope
public static final ELUtils.Scope
pack-priv String
public static final ELUtils.Scope
public static final ELUtils.Scope

Constructor Summary

AccessConstructor and Description
private
Scope(String scope)

Method Summary

Modifier and TypeMethod and Description
public String
toString()

Overrides java.lang.Enum.toString.

Returns the name of this enum constant, as contained in the declaration.
public static ELUtils.Scope
public static ELUtils.Scope[]
Inherited from java.lang.Enum:
clonecompareTodescribeConstableequalsfinalizegetDeclaringClasshashCodenameordinalvalueOf

Field Detail

APPLICATIONback to summary
public static final ELUtils.Scope APPLICATION
NONEback to summary
public static final ELUtils.Scope NONE
REQUESTback to summary
public static final ELUtils.Scope REQUEST
scopeback to summary
pack-priv String scope
SESSIONback to summary
public static final ELUtils.Scope SESSION
VIEWback to summary
public static final ELUtils.Scope VIEW

Constructor Detail

Scopeback to summary
private Scope(String scope)

Method Detail

toStringback to summary
public String toString()

Overrides java.lang.Enum.toString.

Doc from java.lang.Enum.toString.

Returns the name of this enum constant, as contained in the declaration. This method may be overridden, though it typically isn't necessary or desirable. An enum class should override this method when a more "programmer-friendly" string form exists.

Returns:String

the name of this enum constant

Annotations
@Override
valueOfback to summary
public static ELUtils.Scope valueOf(String name)
valuesback to summary
public static ELUtils.Scope[] values()