Package com.sun.faces.el
Class ELUtils
- java.lang.Object
-
- com.sun.faces.el.ELUtils
-
public class ELUtils extends java.lang.ObjectUtility class for EL related methods.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classELUtils.Scope
-
Field Summary
Fields Modifier and Type Field Description static javax.el.ArrayELResolverARRAY_RESOLVERstatic javax.el.BeanELResolverBEAN_RESOLVERstatic javax.el.ResourceBundleELResolverBUNDLE_RESOLVERstatic com.sun.faces.el.CompositeComponentAttributesELResolverCOMPOSITE_COMPONENT_ATTRIBUTES_EL_RESOLVERstatic com.sun.faces.el.FacesResourceBundleELResolverFACES_BUNDLE_RESOLVERstatic com.sun.faces.context.flash.FlashELResolverFLASH_RESOLVERstatic com.sun.faces.el.ImplicitObjectELResolverForJspIMPLICIT_JSP_RESOLVERstatic com.sun.faces.el.ImplicitObjectELResolverIMPLICIT_RESOLVERstatic javax.el.ListELResolverLIST_RESOLVERstatic com.sun.faces.el.ManagedBeanELResolverMANAGED_BEAN_RESOLVERstatic javax.el.MapELResolverMAP_RESOLVERstatic com.sun.faces.el.ResourceELResolverRESOURCE_RESOLVERstatic com.sun.faces.el.ScopedAttributeELResolverSCOPED_RESOLVER
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static voidbuildFacesResolver(com.sun.faces.el.FacesCompositeELResolver composite, com.sun.faces.application.ApplicationAssociate associate)Create theELResolverchain for programmatic EL calls.static voidbuildJSPResolver(com.sun.faces.el.FacesCompositeELResolver composite, com.sun.faces.application.ApplicationAssociate associate)Create theELResolverchain for JSP.static java.lang.Objectcoerce(java.lang.Object value, java.lang.Class<?> toType)static javax.el.ValueExpressioncreateValueExpression(java.lang.String expression)Create aValueExpressionwith the expected type ofObject.classstatic javax.el.ValueExpressioncreateValueExpression(java.lang.String expression, java.lang.Class<?> expectedType)static java.lang.ObjectevaluateValueExpression(javax.el.ValueExpression expression, javax.el.ELContext elContext)static javax.el.ExpressionFactorygetDefaultExpressionFactory(com.sun.faces.application.ApplicationAssociate associate, javax.faces.context.FacesContext facesContext)static javax.el.ExpressionFactorygetDefaultExpressionFactory(javax.faces.context.FacesContext facesContext)static javax.faces.el.PropertyResolvergetDelegatePR(com.sun.faces.application.ApplicationAssociate associate, boolean provideDefault)static javax.faces.el.VariableResolvergetDelegateVR(com.sun.faces.application.ApplicationAssociate associate, boolean provideDefault)static java.util.List<java.lang.String>getExpressionsFromString(java.lang.String expressionString)static ELUtils.ScopegetNarrowestScopeFromExpression(java.lang.String expression)static ELUtils.ScopegetScope(java.lang.String scope)static ELUtils.ScopegetScope(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.ScopegetScopeForExpression(java.lang.String expression)static ELUtils.ScopegetScopeForSingleExpression(java.lang.String value)static booleanhasValidLifespan(ELUtils.Scope expressionScope, ELUtils.Scope beanScope)static booleanisCompositeComponentExpr(java.lang.String expression)static booleanisCompositeComponentLookupWithArgs(java.lang.String expression)static booleanisCompositeComponentMethodExprLookup(java.lang.String expression)static booleanisScopeValid(java.lang.String scopeName)
-
-
-
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 com.sun.faces.el.FacesResourceBundleELResolver FACES_BUNDLE_RESOLVER
-
IMPLICIT_JSP_RESOLVER
public static final com.sun.faces.el.ImplicitObjectELResolverForJsp IMPLICIT_JSP_RESOLVER
-
IMPLICIT_RESOLVER
public static final com.sun.faces.el.ImplicitObjectELResolver IMPLICIT_RESOLVER
-
FLASH_RESOLVER
public static final com.sun.faces.context.flash.FlashELResolver FLASH_RESOLVER
-
LIST_RESOLVER
public static final javax.el.ListELResolver LIST_RESOLVER
-
MANAGED_BEAN_RESOLVER
public static final com.sun.faces.el.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 com.sun.faces.el.ScopedAttributeELResolver SCOPED_RESOLVER
-
RESOURCE_RESOLVER
public static final com.sun.faces.el.ResourceELResolver RESOURCE_RESOLVER
-
COMPOSITE_COMPONENT_ATTRIBUTES_EL_RESOLVER
public static final com.sun.faces.el.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(com.sun.faces.el.FacesCompositeELResolver composite, com.sun.faces.application.ApplicationAssociate associate)Create the
ELResolverchain for programmatic EL calls.- Parameters:
composite- aCompositeELResolverassociate- our ApplicationAssociate
-
buildJSPResolver
public static void buildJSPResolver(com.sun.faces.el.FacesCompositeELResolver composite, com.sun.faces.application.ApplicationAssociate associate)Create the
ELResolverchain for JSP.- Parameters:
composite- aCompositeELResolverassociate- 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(com.sun.faces.application.ApplicationAssociate associate, boolean provideDefault)- Parameters:
associate- theApplicationAssociateprovideDefault- whether or not to return aDummpyPropertyResolverImpl- Returns:
- the
PropertyResolvers set viaApplication.setPropertyResolver(javax.faces.el.PropertyResolver)or, if that isnull, return thePropertyResolverchain from the parsed configuration resources. If either of those are null, andprovideDefaultistrue, return theDummyPropertyResolverImpl.
-
getDelegateVR
public static javax.faces.el.VariableResolver getDelegateVR(com.sun.faces.application.ApplicationAssociate associate, boolean provideDefault)- Parameters:
associate- theApplicationAssociateprovideDefault- whether or not to return aDummpyPropertyResolverImpl- Returns:
- the
VariableResolvers set viaApplication.setVariableResolver(javax.faces.el.VariableResolver)or, if that isnull, return theVariableResolverchain from the parsed configuration resources. If either of those are null, , andprovideDefaultistrue, return theChainAwareVariableResolver.
-
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
nullif it isn't scopedFor example, the expression:
sessionScope.TestBean.oneshould 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:
javax.faces.el.ReferenceSyntaxException- if valueBinding is syntactically invalid
-
createValueExpression
public static javax.el.ValueExpression createValueExpression(java.lang.String expression)
Create aValueExpressionwith the expected type ofObject.class- Parameters:
expression- an EL expression- Returns:
- a new
ValueExpressioninstance based off the providedvalueRef
-
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
-
isScopeValid
public static boolean isScopeValid(java.lang.String scopeName)
-
getDefaultExpressionFactory
public static javax.el.ExpressionFactory getDefaultExpressionFactory(javax.faces.context.FacesContext facesContext)
-
getDefaultExpressionFactory
public static javax.el.ExpressionFactory getDefaultExpressionFactory(com.sun.faces.application.ApplicationAssociate associate, javax.faces.context.FacesContext facesContext)
-
-