Class TypePath


  • public final class TypePath
    extends Object
    The path to a type argument, wildcard bound, array element type, or static inner type within an enclosing type.
    Author:
    Eric Bruneton
    • Field Detail

      • ARRAY_ELEMENT

        public static final int ARRAY_ELEMENT
        A type path step that steps into the element type of an array type. See getStep(int).
        See Also:
        Constant Field Values
      • WILDCARD_BOUND

        public static final int WILDCARD_BOUND
        A type path step that steps into the bound of a wildcard type. See getStep(int).
        See Also:
        Constant Field Values
      • TYPE_ARGUMENT

        public static final int TYPE_ARGUMENT
        A type path step that steps into a type argument of a generic type. See getStep(int).
        See Also:
        Constant Field Values
    • Method Detail

      • getLength

        public int getLength()
        Returns the length of this path, i.e. its number of steps.
        Returns:
        the length of this path.
      • getStepArgument

        public int getStepArgument​(int index)
        Returns the index of the type argument that the given step is stepping into. This method should only be used for steps whose value is TYPE_ARGUMENT.
        Parameters:
        index - an index between 0 and getLength(), exclusive.
        Returns:
        the index of the type argument that the given step is stepping into.
      • fromString

        public static TypePath fromString​(String typePath)
        Converts a type path in string form, in the format used by toString(), into a TypePath object.
        Parameters:
        typePath - a type path in string form, in the format used by toString(). May be null or empty.
        Returns:
        the corresponding TypePath object, or null if the path is empty.