Class WildcardType


  • public class WildcardType
    extends Type
    Represents a generic wildcard. A generic wildcard can have either an upper (extends) or a lower (super) bound. A wildcard declared without a bound ("?") has a default extends bound of "java.lang.Object".
    Since:
    2.0
    Author:
    Jason T. Greene
    • Method Detail

      • create

        public static WildcardType create​(Type bound,
                                          boolean isExtends)
        Create a new mock instance of WildcardType.
        Parameters:
        bound - the bound (lower or upper)
        isExtends - true if lower, false if upper (super)
        Returns:
        thew new mock instance
        Since:
        2.1
      • extendsBound

        public Type extendsBound()
        Returns the extends (upper) bound of this wildcard. If this wildcard declares a super (lower) bound, this method will return java.lang.Object
        Returns:
        the extends bound, or Object if this wildcard has a super bound
      • superBound

        public Type superBound()
        Returns the super (lower) bound of this wildcard. If this wildcard declares an extends (upper) bound, this method will return nnull
        Returns:
        the super bound, or null if this wildcard has a extends bound
      • kind

        public Type.Kind kind()
        Description copied from class: Type
        Returns the kind of Type this is.
        Specified by:
        kind in class Type
        Returns:
        the kind
      • toString

        public String toString()
        Description copied from class: Type
        Returns a string representation for this type. It is similar, yet not equivalent to a Java source code representation.
        Overrides:
        toString in class Type
        Returns:
        the string representation.
      • equals

        public boolean equals​(Object o)
        Description copied from class: Type
        Compares this Type with another type, and returns true if they are equivalent. A type is equivalent to another type if it is the same kind, and all of its fields are equal. This includes annotations, which must be equal as well.
        Overrides:
        equals in class Type
        Parameters:
        o - the type to compare to
        Returns:
        true if equal
        See Also:
        Object.equals(Object)
      • hashCode

        public int hashCode()
        Description copied from class: Type
        Computes a hash code representing this type.
        Overrides:
        hashCode in class Type
        Returns:
        the hash code