Class Ognl
- java.lang.Object
-
- ognl.Ognl
-
public abstract class Ognl extends java.lang.ObjectThis class provides static methods for parsing and interpreting OGNL expressions. The simplest use of the Ognl class is to get the value of an expression from an object, without extra context or pre-parsing.import ognl.Ognl; import ognl.OgnlException; try { result = Ognl.getValue(expression, root); } catch (OgnlException ex) { // Report error or recover }This will parse the expression given and evaluate it against the root object given, returning the result. If there is an error in the expression, such as the property is not found, the exception is encapsulated into an
OgnlException.Other more sophisticated uses of Ognl can pre-parse expressions. This provides two advantages: in the case of user-supplied expressions it allows you to catch parse errors before evaluation and it allows you to cache parsed expressions into an AST for better speed during repeated use. The pre-parsed expression is always returned as an
Objectto simplify use for programs that just wish to store the value for repeated use and do not care that it is an AST. If it does care it can always safely cast the value to anASTtype.The Ognl class also takes a context map as one of the parameters to the set and get methods. This allows you to put your own variables into the available namespace for OGNL expressions. The default context contains only the
#rootand#contextkeys, which are required to be present. TheaddDefaultContext(Object, Map)method will alter an existingMapto put the defaults in. Here is an example that shows how to extract thedocumentNameproperty out of the root object and append a string with the current user name in parens:private Map context = new HashMap(); public void setUserName(String value) { context.put("userName", value); } try { // get value using our own custom context map result = Ognl.getValue("documentName + \" (\" + ((#userName == null) ? \"<nobody>\" : #userName) + \")\"", context, root); } catch (OgnlException ex) { // Report error or recover }
-
-
Field Summary
Fields Modifier and Type Field Description private static java.lang.IntegerexpressionMaxLengthprivate static java.lang.BooleanexpressionMaxLengthFrozen
-
Constructor Summary
Constructors Modifier Constructor Description privateOgnl()You can't make one of these.
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static OgnlContextaddDefaultContext(java.lang.Object root, ClassResolver classResolver, OgnlContext context)Appends the standard naming context for evaluating an OGNL expression into the context given so that cached maps can be used as a context.static OgnlContextaddDefaultContext(java.lang.Object root, ClassResolver classResolver, TypeConverter converter, OgnlContext context)Appends the standard naming context for evaluating an OGNL expression into the context given so that cached maps can be used as a context.static OgnlContextaddDefaultContext(java.lang.Object root, MemberAccess memberAccess, ClassResolver classResolver, TypeConverter converter, OgnlContext initialContext)Appends the standard naming context for evaluating an OGNL expression into the context given so that cached maps can be used as a context.static OgnlContextaddDefaultContext(java.lang.Object root, OgnlContext context)Appends the standard naming context for evaluating an OGNL expression into the context given so that cached maps can be used as a context.static voidapplyExpressionMaxLength(java.lang.Integer expressionMaxLength)Applies a maximum allowed length on OGNL expressions for security reasons.static NodecompileExpression(OgnlContext context, java.lang.Object root, java.lang.String expression)Parses and compiles the given expression using theOgnlExpressionCompilerreturned fromOgnlRuntime.getCompiler().static OgnlContextcreateDefaultContext(java.lang.Object root)Creates and returns a new standard naming context for evaluating an OGNL expression.static OgnlContextcreateDefaultContext(java.lang.Object root, java.util.Map<java.lang.String,java.lang.Object> values)Creates and returns a new standard naming context for evaluating an OGNL expression.static OgnlContextcreateDefaultContext(java.lang.Object root, ClassResolver classResolver)Creates and returns a new standard naming context for evaluating an OGNL expression.static OgnlContextcreateDefaultContext(java.lang.Object root, ClassResolver classResolver, TypeConverter converter)Creates and returns a new standard naming context for evaluating an OGNL expression.static OgnlContextcreateDefaultContext(java.lang.Object root, MemberAccess memberAccess)Creates and returns a new standard naming context for evaluating an OGNL expression.static OgnlContextcreateDefaultContext(java.lang.Object root, MemberAccess memberAccess, ClassResolver classResolver, TypeConverter converter)Creates and returns a new standard naming context for evaluating an OGNL expression.static voidfreezeExpressionMaxLength()Freezes (prevents updates to) the maximum allowed length on OGNL expressions at the current value.static EvaluationgetLastEvaluation(OgnlContext context)Gets the lastEvaluationexecuted on the given context.static java.lang.ObjectgetRoot(OgnlContext context)Gets the stored root object for the given context - if any.static TypeConvertergetTypeConverter(OgnlContext context)Gets the currently configuredTypeConverterfor the given context - if any.static java.lang.ObjectgetValue(java.lang.Object tree, java.lang.Object root)Evaluates the given OGNL expression tree to extract a value from the given root object.static java.lang.ObjectgetValue(java.lang.Object tree, java.lang.Object root, java.lang.Class<?> resultType)Evaluates the given OGNL expression tree to extract a value from the given root object.static java.lang.ObjectgetValue(java.lang.Object tree, OgnlContext context, java.lang.Object root)Evaluates the given OGNL expression tree to extract a value from the given root object.static java.lang.ObjectgetValue(java.lang.Object tree, OgnlContext context, java.lang.Object root, java.lang.Class<?> resultType)Evaluates the given OGNL expression tree to extract a value from the given root object.static java.lang.ObjectgetValue(java.lang.String expression, java.lang.Object root)Convenience method that combines calls toparseExpressionandgetValue.static java.lang.ObjectgetValue(java.lang.String expression, java.lang.Object root, java.lang.Class<?> resultType)Convenience method that combines calls toparseExpressionandgetValue.static java.lang.ObjectgetValue(java.lang.String expression, OgnlContext context, java.lang.Object root)Evaluates the given OGNL expression to extract a value from the given root object in a given contextstatic java.lang.ObjectgetValue(java.lang.String expression, OgnlContext context, java.lang.Object root, java.lang.Class<?> resultType)Evaluates the given OGNL expression to extract a value from the given root object in a given contextstatic java.lang.ObjectgetValue(ExpressionAccessor expression, OgnlContext context, java.lang.Object root)Gets the value represented by the given pre-compiled expression on the specified root object.static java.lang.ObjectgetValue(ExpressionAccessor expression, OgnlContext context, java.lang.Object root, java.lang.Class<?> resultType)Gets the value represented by the given pre-compiled expression on the specified root object.static booleanisConstant(java.lang.Object tree)Same asisConstant(String, OgnlContext)- only theMapcontext is created for you.static booleanisConstant(java.lang.Object tree, OgnlContext context)Checks if the specifiedNodeinstance represents a constant expression.static booleanisConstant(java.lang.String expression)Same asisConstant(String, OgnlContext)- only theMapinstance is created for you.static booleanisConstant(java.lang.String expression, OgnlContext context)Checks if the specified expression represents a constant expression.static booleanisSimpleNavigationChain(java.lang.Object tree)static booleanisSimpleNavigationChain(java.lang.Object tree, OgnlContext context)static booleanisSimpleNavigationChain(java.lang.String expression)static booleanisSimpleNavigationChain(java.lang.String expression, OgnlContext context)static booleanisSimpleProperty(java.lang.Object tree)static booleanisSimpleProperty(java.lang.Object tree, OgnlContext context)static booleanisSimpleProperty(java.lang.String expression)static booleanisSimpleProperty(java.lang.String expression, OgnlContext context)static java.lang.ObjectparseExpression(java.lang.String expression)Parses the given OGNL expression and returns a tree representation of the expression that can be used byOgnlstatic methods.static voidsetRoot(OgnlContext context, java.lang.Object root)Sets the root object to use for all expressions in the given context - doesn't necessarily replace root object instances explicitly passed in to other expression resolving methods on this class.static voidsetValue(java.lang.Object tree, java.lang.Object root, java.lang.Object value)Evaluates the given OGNL expression tree to insert a value into the object graph rooted at the given root object.static voidsetValue(java.lang.Object tree, OgnlContext context, java.lang.Object root, java.lang.Object value)Evaluates the given OGNL expression tree to insert a value into the object graph rooted at the given root object.static voidsetValue(java.lang.String expression, java.lang.Object root, java.lang.Object value)Convenience method that combines calls toparseExpressionandsetValue.static voidsetValue(java.lang.String expression, OgnlContext context, java.lang.Object root, java.lang.Object value)Evaluates the given OGNL expression to insert a value into the object graph rooted at the given root object given the context.static voidsetValue(ExpressionAccessor expression, OgnlContext context, java.lang.Object root, java.lang.Object value)Sets the value given using the pre-compiled expression on the specified root object.static voidthawExpressionMaxLength()Thaws (allows updates to) the maximum allowed length on OGNL expressions.
-
-
-
Method Detail
-
applyExpressionMaxLength
public static void applyExpressionMaxLength(java.lang.Integer expressionMaxLength)
Applies a maximum allowed length on OGNL expressions for security reasons.- Parameters:
expressionMaxLength- the OGNL expressions maximum allowed length. Use null (default) to disable this functionality.- Throws:
java.lang.SecurityException- if the caller is inside OGNL expression itself.java.lang.IllegalStateException- if the expression maximum allowed length is frozen.java.lang.IllegalArgumentException- if the provided expressionMaxLength is < 0.- Since:
- 3.1.26
-
freezeExpressionMaxLength
public static void freezeExpressionMaxLength()
Freezes (prevents updates to) the maximum allowed length on OGNL expressions at the current value. This makes it clear to other OGNL callers that the value should not be changed.- Throws:
java.lang.SecurityException- if the caller is inside OGNL expression itself.- Since:
- 3.1.26
-
thawExpressionMaxLength
public static void thawExpressionMaxLength()
Thaws (allows updates to) the maximum allowed length on OGNL expressions. This makes it clear to other OGNL callers that the value can (again) be changed.- Throws:
java.lang.SecurityException- if the caller is inside OGNL expression itself.- Since:
- 3.1.26
-
parseExpression
public static java.lang.Object parseExpression(java.lang.String expression) throws OgnlExceptionParses the given OGNL expression and returns a tree representation of the expression that can be used byOgnlstatic methods.- Parameters:
expression- the OGNL expression to be parsed- Returns:
- a tree representation of the expression
- Throws:
ExpressionSyntaxException- if the expression is malformedOgnlException- if there is a pathological environmental problem
-
compileExpression
public static Node compileExpression(OgnlContext context, java.lang.Object root, java.lang.String expression) throws java.lang.Exception
Parses and compiles the given expression using theOgnlExpressionCompilerreturned fromOgnlRuntime.getCompiler().- Parameters:
context- The context to use.root- The root object for the given expression.expression- The expression to compile.- Returns:
- The node with a compiled accessor set on
Node.getAccessor()if compilation was successfull. In instances where compilation wasn't possible because of a partially null expression theExpressionAccessorinstance may be null and the compilation of this expression still possible at some as yet indertermined point in the future. - Throws:
java.lang.Exception- If a compilation error occurs.
-
createDefaultContext
public static OgnlContext createDefaultContext(java.lang.Object root)
Creates and returns a new standard naming context for evaluating an OGNL expression.- Parameters:
root- the root of the object graph- Returns:
- a new
OgnlContextwith the keysrootandcontextset appropriately
-
createDefaultContext
public static OgnlContext createDefaultContext(java.lang.Object root, java.util.Map<java.lang.String,java.lang.Object> values)
Creates and returns a new standard naming context for evaluating an OGNL expression.- Parameters:
root- the root of the object graph- Returns:
- a new
OgnlContextwith the keysrootandcontextset appropriately
-
createDefaultContext
public static OgnlContext createDefaultContext(java.lang.Object root, ClassResolver classResolver)
Creates and returns a new standard naming context for evaluating an OGNL expression.- Parameters:
root- The root of the object graph.classResolver- The resolver used to instantiateClassinstances referenced in the expression.- Returns:
- a new OgnlContext with the keys
rootandcontextset appropriately
-
createDefaultContext
public static OgnlContext createDefaultContext(java.lang.Object root, ClassResolver classResolver, TypeConverter converter)
Creates and returns a new standard naming context for evaluating an OGNL expression.- Parameters:
root- The root of the object graph.classResolver- The resolver used to instantiateClassinstances referenced in the expression.converter- Converter used to convert return types of an expression in to their desired types.- Returns:
- a new
OgnlContextwith the keysrootandcontextset appropriately
-
createDefaultContext
public static OgnlContext createDefaultContext(java.lang.Object root, MemberAccess memberAccess, ClassResolver classResolver, TypeConverter converter)
Creates and returns a new standard naming context for evaluating an OGNL expression.- Parameters:
root- The root of the object graph.memberAccess- Java security handling object to determine semantics for accessing normally private/protected methods / fields.classResolver- The resolver used to instantiateClassinstances referenced in the expression.converter- Converter used to convert return types of an expression in to their desired types.- Returns:
- a new
OgnlContextwith the keysrootandcontextset appropriately
-
createDefaultContext
public static OgnlContext createDefaultContext(java.lang.Object root, MemberAccess memberAccess)
Creates and returns a new standard naming context for evaluating an OGNL expression.- Parameters:
root- The root of the object graph.memberAccess- Java security handling object to determine semantics for accessing normally private/protected methods / fields.- Returns:
- a new
OgnlContextwith the keysrootandcontextset appropriately
-
addDefaultContext
public static OgnlContext addDefaultContext(java.lang.Object root, OgnlContext context)
Appends the standard naming context for evaluating an OGNL expression into the context given so that cached maps can be used as a context.- Parameters:
root- the root of the object graphcontext- the context to which OGNL context will be added.- Returns:
OgnlContextwith the keysrootandcontextset appropriately
-
addDefaultContext
public static OgnlContext addDefaultContext(java.lang.Object root, ClassResolver classResolver, OgnlContext context)
Appends the standard naming context for evaluating an OGNL expression into the context given so that cached maps can be used as a context.- Parameters:
root- The root of the object graph.classResolver- The resolver used to instantiateClassinstances referenced in the expression.context- The context to which OGNL context will be added.- Returns:
- Context Map with the keys
rootandcontextset appropriately
-
addDefaultContext
public static OgnlContext addDefaultContext(java.lang.Object root, ClassResolver classResolver, TypeConverter converter, OgnlContext context)
Appends the standard naming context for evaluating an OGNL expression into the context given so that cached maps can be used as a context.- Parameters:
root- The root of the object graph.classResolver- The resolver used to instantiateClassinstances referenced in the expression.converter- Converter used to convert return types of an expression in to their desired types.context- The context to which OGNL context will be added.- Returns:
- Context Map with the keys
rootandcontextset appropriately
-
addDefaultContext
public static OgnlContext addDefaultContext(java.lang.Object root, MemberAccess memberAccess, ClassResolver classResolver, TypeConverter converter, OgnlContext initialContext)
Appends the standard naming context for evaluating an OGNL expression into the context given so that cached maps can be used as a context.- Parameters:
root- the root of the object graphmemberAccess- Definition for handling private/protected access.classResolver- The class loading resolver that should be used to resolve class references.converter- The type converter to be used by default.initialContext- Default context to use, if not anOgnlContextwill be dumped into a newOgnlContextobject.- Returns:
- Context Map with the keys
rootandcontextset appropriately
-
getTypeConverter
public static TypeConverter getTypeConverter(OgnlContext context)
Gets the currently configuredTypeConverterfor the given context - if any.- Parameters:
context- The context to get the converter from.- Returns:
- The converter - or null if none found.
-
setRoot
public static void setRoot(OgnlContext context, java.lang.Object root)
Sets the root object to use for all expressions in the given context - doesn't necessarily replace root object instances explicitly passed in to other expression resolving methods on this class.- Parameters:
context- The context to store the root object in.root- The root object.
-
getRoot
public static java.lang.Object getRoot(OgnlContext context)
Gets the stored root object for the given context - if any.- Parameters:
context- The context to get the root object from.- Returns:
- The root object - or null if none found.
-
getLastEvaluation
public static Evaluation getLastEvaluation(OgnlContext context)
Gets the lastEvaluationexecuted on the given context.- Parameters:
context- The context to get the evaluation from.- Returns:
- The
Evaluation- or null if none was found.
-
getValue
public static java.lang.Object getValue(java.lang.Object tree, OgnlContext context, java.lang.Object root) throws OgnlExceptionEvaluates the given OGNL expression tree to extract a value from the given root object. The default context is set for the given context and root viaaddDefaultContext().- Parameters:
tree- the OGNL expression tree to evaluate, as returned by parseExpression()context- the naming context for the evaluationroot- the root object for the OGNL expression- Returns:
- the result of evaluating the expression
- Throws:
MethodFailedException- if the expression called a method which failedNoSuchPropertyException- if the expression referred to a nonexistent propertyInappropriateExpressionException- if the expression can't be used in this contextOgnlException- if there is a pathological environmental problem
-
getValue
public static java.lang.Object getValue(java.lang.Object tree, OgnlContext context, java.lang.Object root, java.lang.Class<?> resultType) throws OgnlExceptionEvaluates the given OGNL expression tree to extract a value from the given root object. The default context is set for the given context and root viaaddDefaultContext().- Parameters:
tree- the OGNL expression tree to evaluate, as returned by parseExpression()context- the naming context for the evaluationroot- the root object for the OGNL expressionresultType- the converted type of the resultant object, using the context's type converter- Returns:
- the result of evaluating the expression
- Throws:
MethodFailedException- if the expression called a method which failedNoSuchPropertyException- if the expression referred to a nonexistent propertyInappropriateExpressionException- if the expression can't be used in this contextOgnlException- if there is a pathological environmental problem
-
getValue
public static java.lang.Object getValue(ExpressionAccessor expression, OgnlContext context, java.lang.Object root)
Gets the value represented by the given pre-compiled expression on the specified root object.- Parameters:
expression- The pre-compiled expression, as found inNode.getAccessor().context- The ognl context.root- The object to retrieve the expression value from.- Returns:
- The value.
-
getValue
public static java.lang.Object getValue(ExpressionAccessor expression, OgnlContext context, java.lang.Object root, java.lang.Class<?> resultType)
Gets the value represented by the given pre-compiled expression on the specified root object.- Parameters:
expression- The pre-compiled expression, as found inNode.getAccessor().context- The ognl context.root- The object to retrieve the expression value from.resultType- The desired object type that the return value should be converted to using thegetTypeConverter(OgnlContext)}.- Returns:
- The value.
-
getValue
public static java.lang.Object getValue(java.lang.String expression, OgnlContext context, java.lang.Object root) throws OgnlExceptionEvaluates the given OGNL expression to extract a value from the given root object in a given context- Parameters:
expression- the OGNL expression to be parsedcontext- the naming context for the evaluationroot- the root object for the OGNL expression- Returns:
- the result of evaluating the expression
- Throws:
MethodFailedException- if the expression called a method which failedNoSuchPropertyException- if the expression referred to a nonexistent propertyInappropriateExpressionException- if the expression can't be used in this contextOgnlException- if there is a pathological environmental problem- See Also:
parseExpression(String),getValue(Object, Object)
-
getValue
public static java.lang.Object getValue(java.lang.String expression, OgnlContext context, java.lang.Object root, java.lang.Class<?> resultType) throws OgnlExceptionEvaluates the given OGNL expression to extract a value from the given root object in a given context- Parameters:
expression- the OGNL expression to be parsedcontext- the naming context for the evaluationroot- the root object for the OGNL expressionresultType- the converted type of the resultant object, using the context's type converter- Returns:
- the result of evaluating the expression
- Throws:
MethodFailedException- if the expression called a method which failedNoSuchPropertyException- if the expression referred to a nonexistent propertyInappropriateExpressionException- if the expression can't be used in this contextOgnlException- if there is a pathological environmental problem- See Also:
parseExpression(String),getValue(Object, Object)
-
getValue
public static java.lang.Object getValue(java.lang.Object tree, java.lang.Object root) throws OgnlExceptionEvaluates the given OGNL expression tree to extract a value from the given root object.- Parameters:
tree- the OGNL expression tree to evaluate, as returned by parseExpression()root- the root object for the OGNL expression- Returns:
- the result of evaluating the expression
- Throws:
MethodFailedException- if the expression called a method which failedNoSuchPropertyException- if the expression referred to a nonexistent propertyInappropriateExpressionException- if the expression can't be used in this contextOgnlException- if there is a pathological environmental problem
-
getValue
public static java.lang.Object getValue(java.lang.Object tree, java.lang.Object root, java.lang.Class<?> resultType) throws OgnlExceptionEvaluates the given OGNL expression tree to extract a value from the given root object.- Parameters:
tree- the OGNL expression tree to evaluate, as returned by parseExpression()root- the root object for the OGNL expressionresultType- the converted type of the resultant object, using the context's type converter- Returns:
- the result of evaluating the expression
- Throws:
MethodFailedException- if the expression called a method which failedNoSuchPropertyException- if the expression referred to a nonexistent propertyInappropriateExpressionException- if the expression can't be used in this contextOgnlException- if there is a pathological environmental problem
-
getValue
public static java.lang.Object getValue(java.lang.String expression, java.lang.Object root) throws OgnlExceptionConvenience method that combines calls toparseExpressionandgetValue.- Parameters:
expression- the OGNL expression to be parsedroot- the root object for the OGNL expression- Returns:
- the result of evaluating the expression
- Throws:
ExpressionSyntaxException- if the expression is malformedMethodFailedException- if the expression called a method which failedNoSuchPropertyException- if the expression referred to a nonexistent propertyInappropriateExpressionException- if the expression can't be used in this contextOgnlException- if there is a pathological environmental problem- See Also:
parseExpression(String),getValue(Object, Object)
-
getValue
public static java.lang.Object getValue(java.lang.String expression, java.lang.Object root, java.lang.Class<?> resultType) throws OgnlExceptionConvenience method that combines calls toparseExpressionandgetValue.- Parameters:
expression- the OGNL expression to be parsedroot- the root object for the OGNL expressionresultType- the converted type of the resultant object, using the context's type converter- Returns:
- the result of evaluating the expression
- Throws:
ExpressionSyntaxException- if the expression is malformedMethodFailedException- if the expression called a method which failedNoSuchPropertyException- if the expression referred to a nonexistent propertyInappropriateExpressionException- if the expression can't be used in this contextOgnlException- if there is a pathological environmental problem- See Also:
parseExpression(String),getValue(Object, Object)
-
setValue
public static void setValue(java.lang.Object tree, OgnlContext context, java.lang.Object root, java.lang.Object value) throws OgnlExceptionEvaluates the given OGNL expression tree to insert a value into the object graph rooted at the given root object. The default context is set for the given context and root viaaddDefaultContext().- Parameters:
tree- the OGNL expression tree to evaluate, as returned by parseExpression()context- the naming context for the evaluationroot- the root object for the OGNL expressionvalue- the value to insert into the object graph- Throws:
MethodFailedException- if the expression called a method which failedNoSuchPropertyException- if the expression referred to a nonexistent propertyInappropriateExpressionException- if the expression can't be used in this contextOgnlException- if there is a pathological environmental problem
-
setValue
public static void setValue(ExpressionAccessor expression, OgnlContext context, java.lang.Object root, java.lang.Object value)
Sets the value given using the pre-compiled expression on the specified root object.- Parameters:
expression- The pre-compiled expression, as found inNode.getAccessor().context- The ognl context.root- The object to set the expression value on.value- The value to set.
-
setValue
public static void setValue(java.lang.String expression, OgnlContext context, java.lang.Object root, java.lang.Object value) throws OgnlExceptionEvaluates the given OGNL expression to insert a value into the object graph rooted at the given root object given the context.- Parameters:
expression- the OGNL expression to be parsedroot- the root object for the OGNL expressioncontext- the naming context for the evaluationvalue- the value to insert into the object graph- Throws:
MethodFailedException- if the expression called a method which failedNoSuchPropertyException- if the expression referred to a nonexistent propertyInappropriateExpressionException- if the expression can't be used in this contextOgnlException- if there is a pathological environmental problem
-
setValue
public static void setValue(java.lang.Object tree, java.lang.Object root, java.lang.Object value) throws OgnlExceptionEvaluates the given OGNL expression tree to insert a value into the object graph rooted at the given root object.- Parameters:
tree- the OGNL expression tree to evaluate, as returned by parseExpression()root- the root object for the OGNL expressionvalue- the value to insert into the object graph- Throws:
MethodFailedException- if the expression called a method which failedNoSuchPropertyException- if the expression referred to a nonexistent propertyInappropriateExpressionException- if the expression can't be used in this contextOgnlException- if there is a pathological environmental problem
-
setValue
public static void setValue(java.lang.String expression, java.lang.Object root, java.lang.Object value) throws OgnlExceptionConvenience method that combines calls toparseExpressionandsetValue.- Parameters:
expression- the OGNL expression to be parsedroot- the root object for the OGNL expressionvalue- the value to insert into the object graph- Throws:
ExpressionSyntaxException- if the expression is malformedMethodFailedException- if the expression called a method which failedNoSuchPropertyException- if the expression referred to a nonexistent propertyInappropriateExpressionException- if the expression can't be used in this contextOgnlException- if there is a pathological environmental problem- See Also:
parseExpression(String),setValue(Object, Object, Object)
-
isConstant
public static boolean isConstant(java.lang.Object tree, OgnlContext context) throws OgnlExceptionChecks if the specifiedNodeinstance represents a constant expression.- Parameters:
tree- TheNodeto check.context- The context to use.- Returns:
- True if the node is a constant - false otherwise.
- Throws:
OgnlException- If an error occurs checking the expression.
-
isConstant
public static boolean isConstant(java.lang.String expression, OgnlContext context) throws OgnlExceptionChecks if the specified expression represents a constant expression.- Parameters:
expression- The expression to check.context- The context to use.- Returns:
- True if the node is a constant - false otherwise.
- Throws:
OgnlException- If an error occurs checking the expression.
-
isConstant
public static boolean isConstant(java.lang.Object tree) throws OgnlExceptionSame asisConstant(String, OgnlContext)- only theMapcontext is created for you.- Parameters:
tree- TheNodeto check.- Returns:
- True if the node represents a constant expression - false otherwise.
- Throws:
OgnlException- If an exception occurs.
-
isConstant
public static boolean isConstant(java.lang.String expression) throws OgnlExceptionSame asisConstant(String, OgnlContext)- only theMapinstance is created for you.- Parameters:
expression- The expression to check.- Returns:
- True if the expression represents a constant - false otherwise.
- Throws:
OgnlException- If an exception occurs.
-
isSimpleProperty
public static boolean isSimpleProperty(java.lang.Object tree, OgnlContext context) throws OgnlException- Throws:
OgnlException
-
isSimpleProperty
public static boolean isSimpleProperty(java.lang.String expression, OgnlContext context) throws OgnlException- Throws:
OgnlException
-
isSimpleProperty
public static boolean isSimpleProperty(java.lang.Object tree) throws OgnlException- Throws:
OgnlException
-
isSimpleProperty
public static boolean isSimpleProperty(java.lang.String expression) throws OgnlException- Throws:
OgnlException
-
isSimpleNavigationChain
public static boolean isSimpleNavigationChain(java.lang.Object tree, OgnlContext context) throws OgnlException- Throws:
OgnlException
-
isSimpleNavigationChain
public static boolean isSimpleNavigationChain(java.lang.String expression, OgnlContext context) throws OgnlException- Throws:
OgnlException
-
isSimpleNavigationChain
public static boolean isSimpleNavigationChain(java.lang.Object tree) throws OgnlException- Throws:
OgnlException
-
isSimpleNavigationChain
public static boolean isSimpleNavigationChain(java.lang.String expression) throws OgnlException- Throws:
OgnlException
-
-