com.sun.faces.el
public class ELUtils extends java.lang.Object
Utility class for EL related methods.
Modifier and Type | Class and Description |
---|---|
static class |
ELUtils.Scope |
Modifier and Type | Field and Description |
---|---|
private static java.lang.String |
APPLICATION_SCOPE |
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 |
private static java.util.regex.Pattern |
COMPOSITE_COMPONENT_EXPRESSION
Helps to determine if a EL expression represents a composite component
EL expression.
|
private static java.util.regex.Pattern |
COMPOSITE_COMPONENT_LOOKUP_WITH_ARGS
Used to determine if EL method arguments are being passed to a
composite component lookup expression.
|
private static java.lang.String |
COOKIE_IMPLICIT_OBJ |
static FacesResourceBundleELResolver |
FACES_BUNDLE_RESOLVER |
private static java.lang.String |
FACES_CONTEXT_IMPLICIT_OBJ |
static FlashELResolver |
FLASH_RESOLVER |
private static java.lang.String |
HEADER_IMPLICIT_OBJ |
private static java.lang.String |
HEADER_VALUES_IMPLICIT_OBJ |
static ImplicitObjectELResolverForJsp |
IMPLICIT_JSP_RESOLVER |
static ImplicitObjectELResolver |
IMPLICIT_RESOLVER |
private static java.lang.String |
INIT_PARAM_IMPLICIT_OBJ |
static javax.el.ListELResolver |
LIST_RESOLVER |
static ManagedBeanELResolver |
MANAGED_BEAN_RESOLVER |
static javax.el.MapELResolver |
MAP_RESOLVER |
private static java.util.regex.Pattern |
METHOD_EXPRESSION_LOOKUP
Use to determine if an expression being considered as a
MethodExpression is a simple lookup (i.e.
|
private static java.lang.String |
PARAM_IMPLICIT_OBJ |
private static java.lang.String |
PARAM_VALUES_IMPLICIT_OBJ |
private static java.lang.String |
REQUEST_SCOPE |
static ResourceELResolver |
RESOURCE_RESOLVER |
static ScopedAttributeELResolver |
SCOPED_RESOLVER |
private static java.lang.String |
SESSION_SCOPE |
private static java.lang.String |
VIEW_IMPLICIT_OBJ |
private static java.lang.String |
VIEW_SCOPE |
Modifier | Constructor and Description |
---|---|
private |
ELUtils() |
Modifier and Type | Method and Description |
---|---|
private static void |
addELResolvers(javax.el.CompositeELResolver target,
java.util.List<javax.el.ELResolver> resolvers)
Add the
ELResolvers from the provided list
to the target CompositeELResolver . |
private static void |
addPropertyResolvers(javax.el.CompositeELResolver target,
ApplicationAssociate associate)
Add any
PropertyResolver s to the specified
CompositeELResolver . |
private static void |
addVariableResolvers(FacesCompositeELResolver target,
FacesCompositeELResolver.ELResolverChainType chainType,
ApplicationAssociate associate)
Add any
VariableResolver s to the specified
CompositeELResolver . |
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) |
private static int |
getFirstSegmentIndex(java.lang.String valueBinding)
The the first segment of a String tokenized by a "." or "["
|
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 |
isScopeValid(java.lang.String scopeName) |
private static java.lang.String |
stripBracketsIfNecessary(java.lang.String expression) |
private static final java.util.regex.Pattern COMPOSITE_COMPONENT_EXPRESSION
private static final java.util.regex.Pattern COMPOSITE_COMPONENT_LOOKUP_WITH_ARGS
private static final java.util.regex.Pattern METHOD_EXPRESSION_LOOKUP
private static final java.lang.String APPLICATION_SCOPE
private static final java.lang.String SESSION_SCOPE
private static final java.lang.String REQUEST_SCOPE
private static final java.lang.String VIEW_SCOPE
private static final java.lang.String COOKIE_IMPLICIT_OBJ
private static final java.lang.String FACES_CONTEXT_IMPLICIT_OBJ
private static final java.lang.String HEADER_IMPLICIT_OBJ
private static final java.lang.String HEADER_VALUES_IMPLICIT_OBJ
private static final java.lang.String INIT_PARAM_IMPLICIT_OBJ
private static final java.lang.String PARAM_IMPLICIT_OBJ
private static final java.lang.String PARAM_VALUES_IMPLICIT_OBJ
private static final java.lang.String VIEW_IMPLICIT_OBJ
public static final javax.el.ArrayELResolver ARRAY_RESOLVER
public static final javax.el.BeanELResolver BEAN_RESOLVER
public static final FacesResourceBundleELResolver FACES_BUNDLE_RESOLVER
public static final ImplicitObjectELResolverForJsp IMPLICIT_JSP_RESOLVER
public static final ImplicitObjectELResolver IMPLICIT_RESOLVER
public static final FlashELResolver FLASH_RESOLVER
public static final javax.el.ListELResolver LIST_RESOLVER
public static final ManagedBeanELResolver MANAGED_BEAN_RESOLVER
public static final javax.el.MapELResolver MAP_RESOLVER
public static final javax.el.ResourceBundleELResolver BUNDLE_RESOLVER
public static final ScopedAttributeELResolver SCOPED_RESOLVER
public static final ResourceELResolver RESOURCE_RESOLVER
public static final CompositeComponentAttributesELResolver COMPOSITE_COMPONENT_ATTRIBUTES_EL_RESOLVER
public static boolean isCompositeComponentExpr(java.lang.String expression)
public static boolean isCompositeComponentMethodExprLookup(java.lang.String expression)
public static boolean isCompositeComponentLookupWithArgs(java.lang.String expression)
public static void buildFacesResolver(FacesCompositeELResolver composite, ApplicationAssociate associate)
Create the ELResolver
chain for programmatic EL calls.
composite
- a CompositeELResolver
associate
- our ApplicationAssociatepublic static void buildJSPResolver(FacesCompositeELResolver composite, ApplicationAssociate associate)
Create the ELResolver
chain for JSP.
composite
- a CompositeELResolver
associate
- our ApplicationAssociatepublic static java.lang.Object evaluateValueExpression(javax.el.ValueExpression expression, javax.el.ELContext elContext)
public static javax.faces.el.PropertyResolver getDelegatePR(ApplicationAssociate associate, boolean provideDefault)
associate
- the ApplicationAssociate
provideDefault
- whether or not to return a
DummpyPropertyResolverImpl
PropertyResolver
s 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
.public static javax.faces.el.VariableResolver getDelegateVR(ApplicationAssociate associate, boolean provideDefault)
associate
- the ApplicationAssociate
provideDefault
- whether or not to return a
DummpyPropertyResolverImpl
VariableResolver
s 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
.public static java.util.List<java.lang.String> getExpressionsFromString(java.lang.String expressionString) throws javax.faces.el.ReferenceSyntaxException
expressionString
- the expression string, with delimiters
intact.javax.faces.el.ReferenceSyntaxException
- if the expression string is invalidpublic 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.
valueBinding
- the expressionoutString
- an allocated String Array into which we put the
first segment.javax.faces.el.ReferenceSyntaxException
- if valueBinding is syntactically invalidpublic static javax.el.ValueExpression createValueExpression(java.lang.String expression)
ValueExpression
with the expected type of
Object.class
expression
- an EL expressionValueExpression
instance based off the
provided valueRef
public static javax.el.ValueExpression createValueExpression(java.lang.String expression, java.lang.Class<?> expectedType)
public static java.lang.Object coerce(java.lang.Object value, java.lang.Class<?> toType)
public static ELUtils.Scope getScope(java.lang.String scope)
private static void addELResolvers(javax.el.CompositeELResolver target, java.util.List<javax.el.ELResolver> resolvers)
Add the ELResolvers
from the provided list
to the target CompositeELResolver
.
target
- the CompositeELResolver
to which
the ELResolver
s will be added.resolvers
- a List
of ELResolver
sprivate static void addPropertyResolvers(javax.el.CompositeELResolver target, ApplicationAssociate associate)
Add any PropertyResolver
s to the specified
CompositeELResolver
.
target
- the CompositeELResolver
to which
the PropertyResolver
s will be added.associate
- our ApplicationAssociateprivate static void addVariableResolvers(FacesCompositeELResolver target, FacesCompositeELResolver.ELResolverChainType chainType, ApplicationAssociate associate)
Add any VariableResolver
s to the specified
CompositeELResolver
.
target
- the CompositeELResolver
to which
the VariableResolver
s will be added.associate
- our ApplicationAssociateprivate static int getFirstSegmentIndex(java.lang.String valueBinding)
valueBinding
- the expression from which the first segment
will be obtainedprivate static java.lang.String stripBracketsIfNecessary(java.lang.String expression) throws javax.faces.el.ReferenceSyntaxException
javax.faces.el.ReferenceSyntaxException
public static ELUtils.Scope getScopeForExpression(java.lang.String expression)
public static boolean hasValidLifespan(ELUtils.Scope expressionScope, ELUtils.Scope beanScope) throws javax.faces.el.EvaluationException
javax.faces.el.EvaluationException
public static ELUtils.Scope getScopeForSingleExpression(java.lang.String value) throws javax.faces.el.EvaluationException
javax.faces.el.EvaluationException
public static ELUtils.Scope getNarrowestScopeFromExpression(java.lang.String expression) throws javax.faces.el.ReferenceSyntaxException
javax.faces.el.ReferenceSyntaxException
public static boolean isScopeValid(java.lang.String scopeName)
Copyright © 2002-2010 Oracle America, Inc. All Rights Reserved.