public class ArraySuffix extends ValueSuffix
Represents an operator that obtains a Map entry, an indexed value, a property value, or an indexed property value of an object. The following are the rules for evaluating this operator:
Evaluating a[b] (assuming a.b == a["b"])
a is null
return null
b is null
return null
a is Map
!a.containsKey (b)
return null
a.get(b) == null
return null
otherwise
return a.get(b)
a is List or array
coerce b to int (using coercion rules)
coercion couldn't be performed
error
a.get(b) or Array.get(a, b) throws ArrayIndexOutOfBoundsException or IndexOutOfBoundsException
return null
a.get(b) or Array.get(a, b) throws other exception
error
return a.get(b) or Array.get(a, b)
coerce b to String
b is a readable property of a
getter throws an exception
error
otherwise
return result of getter call
otherwise
error
| Constructor and Description |
|---|
ArraySuffix(Expression pIndex)
Constructor
|
| Modifier and Type | Method and Description |
|---|---|
ValueSuffix |
bindFunctions(FunctionMapper functions) |
Object |
evaluate(Object pValue,
VariableResolver pResolver,
FunctionMapper functions)
Evaluates the expression in the given context, operating on the
given value.
|
String |
getExpressionString()
Returns the expression in the expression language syntax
|
Expression |
getIndex() |
void |
setIndex(Expression pIndex) |
public ArraySuffix(Expression pIndex)
public Expression getIndex()
public void setIndex(Expression pIndex)
public String getExpressionString()
getExpressionString in class ValueSuffixpublic Object evaluate(Object pValue, VariableResolver pResolver, FunctionMapper functions) throws ELException
evaluate in class ValueSuffixELExceptionpublic ValueSuffix bindFunctions(FunctionMapper functions) throws ELException
bindFunctions in class ValueSuffixELExceptionCopyright © 2003-2013 The Apache Software Foundation. All Rights Reserved.