Class JavaTypeDefinition

    • Constructor Detail

    • Method Detail

      • getType

        public abstract Class<?> getType()
        Description copied from interface: TypeDefinition
        Get the raw Class type of the definition.
        Specified by:
        getType in interface TypeDefinition
        Returns:
        Raw Class type.
      • isGeneric

        public abstract boolean isGeneric()
      • getGenericTypeIndex

        public static int getGenericTypeIndex​(TypeVariable<?>[] typeParameters,
                                              String parameterName)
      • isClassOrInterface

        public abstract boolean isClassOrInterface()
      • isNullType

        public abstract boolean isNullType()
      • isPrimitive

        public abstract boolean isPrimitive()
      • getTypeParameterCount

        public abstract int getTypeParameterCount()
      • isArrayType

        public abstract boolean isArrayType()
      • getComponentType

        public abstract JavaTypeDefinition getComponentType()
        Gets the component type of this type definition if it is an array type. The component type of an array is the type is the same type as the array, with one less dimension, e.g. the component type of int[][][] is int[][].
        Returns:
        The component type of this array type
        Throws:
        IllegalStateException - if this definition doesn't identify an array type
        See Also:
        getElementType()
      • getElementType

        public abstract JavaTypeDefinition getElementType()
        Gets the element type of this type definition if it is an array type. The component type of an array is the type is the same type as the array, stripped of all array dimensions, e.g. the element type of int[][][] is int.
        Returns:
        The element type of this array type, or this type definition if isArrayType() returns false
        See Also:
        getComponentType()
      • withDimensions

        public abstract JavaTypeDefinition withDimensions​(int numDimensions)
        Returns the type definition of the array type which has the given number of array dimensions, plus the dimensions of this type definition. Examples, assuming JavaTypeDefinition and Class are interchangeable (== is equality, not identity):
        • int.class.withDimensions(3) == int[][][].class
        • int[].class.withDimensions(1) == int[][].class
        • c.withDimensions(0) == c
        • n > 0 => c.withDimensions(n).getComponentType() == c.withDimensions(n - 1)
        Parameters:
        numDimensions - Number of dimensions added to this type in the resulting array type
        Returns:
        A new type definition, or this if numDimensions == 0
        Throws:
        IllegalArgumentException - if numDimensions < 0
      • equals

        public abstract boolean equals​(Object obj)
        Overrides:
        equals in class Object
      • hashCode

        public abstract int hashCode()
        Overrides:
        hashCode in class Object
      • getErasedSuperTypeSet

        public abstract Set<Class<?>> getErasedSuperTypeSet()
      • isRawType

        public abstract boolean isRawType()
        Returns true if this type has type parameters and has not been parameterized, e.g. List instead of List<T>.
      • isExactType

        public final boolean isExactType()
      • isUpperBound

        public final boolean isUpperBound()
      • isLowerBound

        public final boolean isLowerBound()
      • isIntersectionType

        public abstract boolean isIntersectionType()
      • isWildcard

        public final boolean isWildcard()
      • getJavaTypeCount

        public abstract int getJavaTypeCount()
      • shallowString

        protected abstract String shallowString()