Interface Path.Node

    • Method Summary

      All Methods Instance Methods Abstract Methods 
      Modifier and Type Method Description
      <T extends Path.Node>
      T
      as​(java.lang.Class<T> nodeType)
      Narrows the type of this node down to the given type.
      java.lang.Integer getIndex​()  
      java.lang.Object getKey​()  
      ElementKind getKind​()
      The kind of element represented by the node.
      java.lang.String getName​()
      Returns the name of the element which the node represents: null if it is a leaf node which represents an entity / bean.
      boolean isInIterable​()  
      java.lang.String toString​()
      Returns a human-readable representation of this node.
    • Method Detail

      • getName

        java.lang.String getName​()
        Returns the name of the element which the node represents:
        • null if it is a leaf node which represents an entity / bean. In particular, the node representing the root object.
        • The property name for a property.
        • The method name for a method.
        • The unqualified name of the type declaring the constructor for a constructor.
        • The parameter named as defined by the ParameterNameProvider for a method or constructor parameter.
        • The literal <cross-parameter> for a method or constructor cross-parameter.
        • The literal <return value> for a method or constructor return value.
        • The node name as defined by the ValueExtractor for a container element; specifically, the literal <list element> for elements stored in a list, the literal <iterable element> for elements stored in an Iterable, the literal <map key> for the keys stored in a Map and the literal <map value> for the values stored in a Map.
        Returns:
        name of the element which the node represents
      • isInIterable

        boolean isInIterable​()
        Returns:
        true if the node represents an object contained in a multi-valued container such as Iterable or Map or an array, false otherwise
      • getIndex

        java.lang.Integer getIndex​()
        Returns:
        the index the node is placed in if contained in an array, a List or any other container supporting indexed access, null otherwise
      • getKey

        java.lang.Object getKey​()
        Returns:
        the key the node is placed in if contained in a Map or any other container supporting keyed access, null otherwise
      • as

        <T extends Path.Node> T as​(java.lang.Class<T> nodeType)
        Narrows the type of this node down to the given type. The appropriate type should be checked before by calling getKind().
        Type Parameters:
        T - the type to narrow down to
        Parameters:
        nodeType - class object representing the descriptor type to narrow down to to
        Returns:
        this node narrowed down to the given type.
        Throws:
        java.lang.ClassCastException - if this node is not assignable to the type T
        Since:
        1.1
      • toString

        java.lang.String toString​()
        Returns a human-readable representation of this node.

        Clients should not rely on any specific structure of the returned value. Instead they should obtain any required information by calling the methods on this interface and its sub-types.

        Overrides:
        toString in class java.lang.Object
        Returns:
        a human-readable representation of this node
        Since:
        2.0