Class ArrayType

    • Method Detail

      • accept

        public <R,​A> R accept​(GenericVisitor<R,​A> v,
                                    A arg)
        Description copied from interface: Visitable
        Accept method for visitor support.
        Specified by:
        accept in interface Visitable
        Type Parameters:
        R - the type of the return value of the visitor
        A - the type the user argument passed to the visitor
        Parameters:
        v - the visitor implementation
        arg - the argument passed to the visitor (of type A)
        Returns:
        the result of the visit (of type R)
      • accept

        public <A> void accept​(VoidVisitor<A> v,
                               A arg)
        Description copied from interface: Visitable
        Accept method for visitor support.
        Specified by:
        accept in interface Visitable
        Type Parameters:
        A - the type the argument passed for the visitor
        Parameters:
        v - the visitor implementation
        arg - any value relevant for the visitor (of type A)
      • getComponentType

        public Type getComponentType()
      • setComponentType

        public ArrayType setComponentType​(Type componentType)
      • wrapInArrayTypes

        @SafeVarargs
        public static Type wrapInArrayTypes​(Type type,
                                            java.util.List<ArrayType.ArrayBracketPair>... arrayBracketPairLists)
        Takes lists of arrayBracketPairs, assumes the lists are ordered outer to inner and the pairs are ordered left to right. The type gets wrapped in ArrayTypes so that the outermost ArrayType corresponds to the leftmost ArrayBracketPair in the first list.
      • unwrapArrayTypes

        public static Pair<Type,​java.util.List<ArrayType.ArrayBracketPair>> unwrapArrayTypes​(Type type)
        Takes a type that may be an ArrayType. Unwraps ArrayTypes until the element type is found.
        Returns:
        a pair of the element type, and the unwrapped ArrayTypes, if any.
      • asString

        public java.lang.String asString()
        Specified by:
        asString in class Type
      • replace

        public boolean replace​(Node node,
                               Node replacementNode)
        Overrides:
        replace in class Type
      • isArrayType

        public boolean isArrayType()
        Overrides:
        isArrayType in class Type
      • ifArrayType

        public void ifArrayType​(java.util.function.Consumer<ArrayType> action)
        Overrides:
        ifArrayType in class Type
      • getElementType

        public Type getElementType()
        Finds the element type, meaning: the type without ArrayTypes around it.

        In "int[] a[];", the element type is int.

        Overrides:
        getElementType in class Type
      • getArrayLevel

        public int getArrayLevel()
        returns the array level that is 0 for non array type.
        Overrides:
        getArrayLevel in class Type