Package com.oracle.truffle.api.dsl
Interface NodeFactory<T>
-
- All Known Implementing Classes:
NodeFactoryBase
public interface NodeFactory<T>
Enables the dynamic creation of generated nodes. It provides an convenient way to instantiate generated node classes without using reflection.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description T
createNode(java.lang.Object... arguments)
Instantiates the node using the arguments array.java.util.List<java.lang.Class<? extends Node>>
getExecutionSignature()
Returns a list of children that will be executed by the created node.java.lang.Class<T>
getNodeClass()
Returns the node class that will get created bycreateNode(Object...)
.java.util.List<java.util.List<java.lang.Class<?>>>
getNodeSignatures()
Returns a list of signatures that can be used to invokecreateNode(Object...)
.
-
-
-
Method Detail
-
createNode
T createNode(java.lang.Object... arguments)
Instantiates the node using the arguments array. The arguments length and types must suffice one of the returned signatures ingetNodeSignatures()
. If the arguments array does not suffice one of the node signatures anIllegalArgumentException
is thrown.- Parameters:
arguments
- the argument values- Returns:
- the instantiated node
- Throws:
java.lang.IllegalArgumentException
-
getNodeClass
java.lang.Class<T> getNodeClass()
Returns the node class that will get created bycreateNode(Object...)
. The node class does not match exactly to the instantiated object but they are guaranteed to be assignable.
-
getNodeSignatures
java.util.List<java.util.List<java.lang.Class<?>>> getNodeSignatures()
Returns a list of signatures that can be used to invokecreateNode(Object...)
.
-
getExecutionSignature
java.util.List<java.lang.Class<? extends Node>> getExecutionSignature()
Returns a list of children that will be executed by the created node. This is useful for base nodes that can execute a variable amount of nodes.
-
-