Package com.sun.faces.el
Class ELUtils
java.lang.Object
com.sun.faces.el.ELUtils
public class ELUtils extends Object
Utility class for EL related methods.
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
ELUtils.Scope
-
Field Summary
Fields Modifier and Type Field Description static jakarta.el.ArrayELResolver
ARRAY_RESOLVER
static jakarta.el.BeanELResolver
BEAN_RESOLVER
static jakarta.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 jakarta.el.ListELResolver
LIST_RESOLVER
static ManagedBeanELResolver
MANAGED_BEAN_RESOLVER
static jakarta.el.MapELResolver
MAP_RESOLVER
static ResourceELResolver
RESOURCE_RESOLVER
static ScopedAttributeELResolver
SCOPED_RESOLVER
-
Method Summary
Modifier and Type Method Description static void
buildFacesResolver(FacesCompositeELResolver composite, ApplicationAssociate associate)
Create theELResolver
chain for programmatic EL calls.static void
buildJSPResolver(FacesCompositeELResolver composite, ApplicationAssociate associate)
Create theELResolver
chain for JSP.static Object
coerce(Object value, Class<?> toType)
static jakarta.el.ValueExpression
createValueExpression(String expression)
Create aValueExpression
with the expected type ofObject.class
static jakarta.el.ValueExpression
createValueExpression(String expression, Class<?> expectedType)
static Object
evaluateValueExpression(jakarta.el.ValueExpression expression, jakarta.el.ELContext elContext)
static jakarta.el.ExpressionFactory
getDefaultExpressionFactory(ApplicationAssociate associate, FacesContext facesContext)
static jakarta.el.ExpressionFactory
getDefaultExpressionFactory(FacesContext facesContext)
static PropertyResolver
getDelegatePR(ApplicationAssociate associate, boolean provideDefault)
static VariableResolver
getDelegateVR(ApplicationAssociate associate, boolean provideDefault)
static List<String>
getExpressionsFromString(String expressionString)
static ELUtils.Scope
getNarrowestScopeFromExpression(String expression)
static ELUtils.Scope
getScope(String scope)
static ELUtils.Scope
getScope(String valueBinding, 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(String expression)
static ELUtils.Scope
getScopeForSingleExpression(String value)
static boolean
hasValidLifespan(ELUtils.Scope expressionScope, ELUtils.Scope beanScope)
static boolean
isCompositeComponentExpr(String expression)
static boolean
isCompositeComponentLookupWithArgs(String expression)
static boolean
isCompositeComponentMethodExprLookup(String expression)
static boolean
isScopeValid(String scopeName)
-
Field Details
-
ARRAY_RESOLVER
public static final jakarta.el.ArrayELResolver ARRAY_RESOLVER -
BEAN_RESOLVER
public static final jakarta.el.BeanELResolver BEAN_RESOLVER -
FACES_BUNDLE_RESOLVER
-
IMPLICIT_JSP_RESOLVER
-
IMPLICIT_RESOLVER
-
FLASH_RESOLVER
-
LIST_RESOLVER
public static final jakarta.el.ListELResolver LIST_RESOLVER -
MANAGED_BEAN_RESOLVER
-
MAP_RESOLVER
public static final jakarta.el.MapELResolver MAP_RESOLVER -
BUNDLE_RESOLVER
public static final jakarta.el.ResourceBundleELResolver BUNDLE_RESOLVER -
SCOPED_RESOLVER
-
RESOURCE_RESOLVER
-
COMPOSITE_COMPONENT_ATTRIBUTES_EL_RESOLVER
public static final CompositeComponentAttributesELResolver COMPOSITE_COMPONENT_ATTRIBUTES_EL_RESOLVER
-
-
Method Details
-
isCompositeComponentExpr
-
isCompositeComponentMethodExprLookup
-
isCompositeComponentLookupWithArgs
-
buildFacesResolver
public static void buildFacesResolver(FacesCompositeELResolver composite, ApplicationAssociate associate)Create the
ELResolver
chain for programmatic EL calls.- Parameters:
composite
- aCompositeELResolver
associate
- our ApplicationAssociate
-
buildJSPResolver
public static void buildJSPResolver(FacesCompositeELResolver composite, ApplicationAssociate associate)Create the
ELResolver
chain for JSP.- Parameters:
composite
- aCompositeELResolver
associate
- our ApplicationAssociate
-
evaluateValueExpression
public static Object evaluateValueExpression(jakarta.el.ValueExpression expression, jakarta.el.ELContext elContext) -
getDelegatePR
public static PropertyResolver getDelegatePR(ApplicationAssociate associate, boolean provideDefault)- Parameters:
associate
- theApplicationAssociate
provideDefault
- whether or not to return aDummpyPropertyResolverImpl
- Returns:
- the
PropertyResolver
s set viaApplication.setPropertyResolver(jakarta.faces.el.PropertyResolver)
or, if that isnull
, return thePropertyResolver
chain from the parsed configuration resources. If either of those are null, andprovideDefault
istrue
, return theDummyPropertyResolverImpl
.
-
getDelegateVR
public static VariableResolver getDelegateVR(ApplicationAssociate associate, boolean provideDefault)- Parameters:
associate
- theApplicationAssociate
provideDefault
- whether or not to return aDummpyPropertyResolverImpl
- Returns:
- the
VariableResolver
s set viaApplication.setVariableResolver(jakarta.faces.el.VariableResolver)
or, if that isnull
, return theVariableResolver
chain from the parsed configuration resources. If either of those are null, , andprovideDefault
istrue
, return theChainAwareVariableResolver
.
-
getExpressionsFromString
public static List<String> getExpressionsFromString(String expressionString) throws ReferenceSyntaxException- Parameters:
expressionString
- the expression string, with delimiters intact.- Returns:
- a List of expressions from the expressionString
- Throws:
ReferenceSyntaxException
- if the expression string is invalid
-
getScope
public static ELUtils.Scope getScope(String valueBinding, String[] outString) throws ReferenceSyntaxExceptionThis 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 scopedFor example, the expression:
sessionScope.TestBean.one
should return "session" as the scope.- Parameters:
valueBinding
- the expressionoutString
- an allocated String Array into which we put the first segment.- Returns:
- the scope of the expression
- Throws:
ReferenceSyntaxException
- if valueBinding is syntactically invalid
-
createValueExpression
Create aValueExpression
with the expected type ofObject.class
- Parameters:
expression
- an EL expression- Returns:
- a new
ValueExpression
instance based off the providedvalueRef
-
createValueExpression
-
coerce
-
getScope
-
getScopeForExpression
-
hasValidLifespan
public static boolean hasValidLifespan(ELUtils.Scope expressionScope, ELUtils.Scope beanScope) throws EvaluationException- Throws:
EvaluationException
-
getScopeForSingleExpression
- Throws:
EvaluationException
-
getNarrowestScopeFromExpression
public static ELUtils.Scope getNarrowestScopeFromExpression(String expression) throws ReferenceSyntaxException- Throws:
ReferenceSyntaxException
-
isScopeValid
-
getDefaultExpressionFactory
-
getDefaultExpressionFactory
public static jakarta.el.ExpressionFactory getDefaultExpressionFactory(ApplicationAssociate associate, FacesContext facesContext)
-