Package org.jboss.jandex
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
- Author:
- Jason T. Greene
-
-
Field Summary
-
Fields inherited from class org.jboss.jandex.Type
EMPTY_ARRAY
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description WildcardType
asWildcardType()
Casts this type to aWildcardType
and returns it if the kind isType.Kind.WILDCARD_TYPE
Throws an exception otherwise.static WildcardType
create(Type bound, boolean isExtends)
Create a new mock instance of WildcardType.boolean
equals(Object o)
Compares this Type with another type, and returns true if they are equivalent.Type
extendsBound()
Returns the extends (upper) bound of this wildcard.int
hashCode()
Computes a hash code representing this type.Type.Kind
kind()
Returns the kind of Type this is.Type
superBound()
Returns the super (lower) bound of this wildcard.String
toString()
Returns a string representation for this type.-
Methods inherited from class org.jboss.jandex.Type
annotation, annotations, asArrayType, asClassType, asParameterizedType, asPrimitiveType, asTypeVariable, asUnresolvedTypeVariable, asVoidType, create, hasAnnotation, name
-
-
-
-
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 returnjava.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
-
asWildcardType
public WildcardType asWildcardType()
Description copied from class:Type
Casts this type to aWildcardType
and returns it if the kind isType.Kind.WILDCARD_TYPE
Throws an exception otherwise.- Overrides:
asWildcardType
in classType
- 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.
-
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 classType
- Parameters:
o
- the type to compare to- Returns:
- true if equal
- See Also:
Object.equals(Object)
-
-