Package org.instancio
Interface Node
public interface Node
Represents a single
Node
of a node hierarchy
created for a given Type
. A node can represent:
- the root class
- field of a class
- an element of a collection, or in general, a generic type argument,
for example, the type of an
Optional
value
- Since:
- 2.11.0
-
Method Summary
Modifier and TypeMethodDescriptiongetField()
Returns the field of this node, if available.Returns the parent of this node, ornull
if this node is the root.Returns the setter of this node, if available, and ifKeys.ASSIGNMENT_TYPE
is set toAssignmentType.METHOD
.Class
<?> Returns the target class of this node.
-
Method Details
-
getTargetClass
Class<?> getTargetClass()Returns the target class of this node.If this node represents a field, generally the target class will be the same as
Field.getType()
. However, there are cases where the target class may differ, for example:- when a subtype is specified, then the node's target class will represent the subtype.
- when the node represents a generic type, then the target class will represent the resolved type argument.
- Returns:
- target class of this node, never
null
- Since:
- 2.11.0
-
getField
Field getField()Returns the field of this node, if available.- Returns:
- field of this node, or
null
if the node has no field - Since:
- 2.11.0
-
getParent
Node getParent()Returns the parent of this node, ornull
if this node is the root.- Returns:
- parent of this node
- Since:
- 3.5.0
-
getSetter
Method getSetter()Returns the setter of this node, if available, and ifKeys.ASSIGNMENT_TYPE
is set toAssignmentType.METHOD
.- Returns:
- setter of this node, or
null
if the node has no setter - Since:
- 4.0.0
-