Class WildcardType

java.lang.Object
org.jboss.jandex.Type
org.jboss.jandex.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
  • Field Details

    • OBJECT

      private static Type OBJECT
    • isExtends

      private final boolean isExtends
    • bound

      private final Type bound
    • hash

      private int hash
  • Constructor Details

    • WildcardType

      WildcardType(Type bound, boolean isExtends)
    • WildcardType

      WildcardType(Type bound, boolean isExtends, AnnotationInstance[] annotations)
  • Method Details

    • 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
    • bound

      Type bound()
    • isExtends

      boolean isExtends()
    • 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
    • asWildcardType

      public WildcardType asWildcardType()
      Description copied from class: Type
      Casts this type to a WildcardType and returns it if the kind is Type.Kind.WILDCARD_TYPE Throws an exception otherwise.
      Overrides:
      asWildcardType in class Type
      Returns:
      a ClassType
    • 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.
    • copyType

      Type copyType(AnnotationInstance[] newAnnotations)
      Specified by:
      copyType in class Type
    • copyType

      Type copyType(Type bound)
    • 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:
    • 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