org.springframework.expression.spel.ast
Class ConstructorReference
java.lang.Object
org.antlr.runtime.tree.BaseTree
org.antlr.runtime.tree.CommonTree
org.springframework.expression.spel.ast.SpelNodeImpl
org.springframework.expression.spel.ast.ConstructorReference
- All Implemented Interfaces:
- java.io.Serializable, org.antlr.runtime.tree.Tree, SpelNode
public class ConstructorReference
- extends SpelNodeImpl
Represents the invocation of a constructor. Either a constructor on a regular type or construction of an array. When
an array is constructed, an initializer can be specified.
Examples:
new String('hello world')
new int[]{1,2,3,4}
new int[3] new int[3]{1,2,3}
- Since:
- 3.0
- Author:
- Andy Clement, Juergen Hoeller
- See Also:
- Serialized Form
| Fields inherited from class org.antlr.runtime.tree.CommonTree |
startIndex, stopIndex, token |
| Fields inherited from class org.antlr.runtime.tree.BaseTree |
children |
| Fields inherited from interface org.antlr.runtime.tree.Tree |
INVALID_NODE |
|
Constructor Summary |
ConstructorReference(org.antlr.runtime.Token payload,
boolean isArrayConstructor)
|
| Methods inherited from class org.antlr.runtime.tree.CommonTree |
dupNode, getCharPositionInLine, getLine, getText, getToken, getTokenStartIndex, getTokenStopIndex, getType, isNil, setTokenStartIndex, setTokenStopIndex, toString |
| Methods inherited from class org.antlr.runtime.tree.BaseTree |
addChild, addChildren, createChildrenList, deleteChild, dupTree, getChildCount, getFirstChildWithType, setChild, toStringTree |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
ConstructorReference
public ConstructorReference(org.antlr.runtime.Token payload,
boolean isArrayConstructor)
getValueInternal
public java.lang.Object getValueInternal(ExpressionState state)
throws EvaluationException
- Implements getValue() - delegating to the code for building an array or a simple type.
- Specified by:
getValueInternal in class SpelNodeImpl
- Throws:
EvaluationException
toStringAST
public java.lang.String toStringAST()
- Specified by:
toStringAST in interface SpelNode- Specified by:
toStringAST in class SpelNodeImpl
- Returns:
- the string form of this AST node
isWritable
public boolean isWritable(ExpressionState expressionState)
throws SpelException
- Description copied from interface:
SpelNode
- Determine if this expression node will support a setValue() call.
- Specified by:
isWritable in interface SpelNode- Overrides:
isWritable in class SpelNodeImpl
- Parameters:
expressionState - the current expression state (includes the context)
- Returns:
- true if the expression node will allow setValue()
- Throws:
SpelException
findExecutorForConstructor
protected ConstructorExecutor findExecutorForConstructor(java.lang.String typename,
java.lang.Class<?>[] argumentTypes,
ExpressionState state)
throws SpelException
- Go through the list of registered constructor resolvers and see if any can find a constructor that takes the
specified set of arguments.
- Parameters:
typename - the type trying to be constructedargumentTypes - the types of the arguments supplied that the constructor must takestate - the current state of the expression
- Returns:
- a reusable ConstructorExecutor that can be invoked to run the constructor or null
- Throws:
SpelException - if there is a problem locating the constructor