Class InternalNode

java.lang.Object
org.instancio.internal.nodes.InternalNode

public final class InternalNode extends Object
  • Method Details

    • ignoredNode

      public static InternalNode ignoredNode()
    • getNodeKind

      public NodeKind getNodeKind()
    • is

      public boolean is(NodeKind nodeKind)
    • toBuilder

      public InternalNode.Builder toBuilder()
    • builder

      public static InternalNode.Builder builder()
    • getNodeContext

      public NodeContext getNodeContext()
    • getType

      public Type getType()
      Returns the type represented by this node, either a Class or ParameterizedType.
      Returns:
      type represented by this node
    • getRawType

      public Class<?> getRawType()
      Returns the raw type equivalent to this node's getType(). In the absence of subtype mapping, this method and getTargetClass() return the same value.
      Returns:
      raw type represented by this node.
      See Also:
    • getTargetClass

      public Class<?> getTargetClass()
      Returns the target class represented by this node.
      Returns:
      target class represented by this node
      See Also:
    • getField

      public Field getField()
      Returns a field associated with this node, or null if none.
      Returns:
      field, if present, or null
    • getParent

      public InternalNode getParent()
    • getTypeMap

      public TypeMap getTypeMap()
    • getOnlyChild

      public InternalNode getOnlyChild()
    • getChildren

      public List<InternalNode> getChildren()
      Returns this node's children. For "container" nodes like arrays, collections, and maps, the children will be nodes representing array/collection element or map key/value. For other nodes, the children are based on the getTargetClass() fields.

      A node (including container nodes) may not have children in case of cyclic relationships. An empty list would be returned to break the cycle.

      Returns:
      this node's children or an empty list if none
    • hasAncestorEqualToSelf

      public boolean hasAncestorEqualToSelf()
      This method is used for detecting cycles. If this node is equal to any of its ancestors, then there is a cycle.
      Returns:
      true if this node has an ancestor equal to it, false otherwise.
    • getDepth

      public int getDepth()
    • equals

      public boolean equals(@Nullable @Nullable Object o)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • toString

      public String toString()
      Overrides:
      toString in class Object