Top Description Inners Fields Constructors Methods
org.jboss.jandex

public Class WildcardType

extends Type
Class Inheritance

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".
Author
Jason T. Greene
Since
2.0

Nested and Inner Type Summary

Modifier and TypeClass and Description
public static class
WildcardType.Builder

Convenient builder for WildcardType.

Field Summary

Modifier and TypeField and Description
private final Type
private int
private final boolean
public static final WildcardType
UNBOUNDED

A wildcard without a bound, an equivalent of ?

Inherited from org.jboss.jandex.Type:
EMPTY_ARRAY

Constructor Summary

AccessConstructor and Description
pack-priv
WildcardType(Type bound, boolean isExtends)

pack-priv
WildcardType(Type bound, boolean isExtends, AnnotationInstance[] annotations)

Method Summary

Modifier and TypeMethod and Description
public WildcardType
asWildcardType()

Overrides org.jboss.jandex.Type.asWildcardType.

Casts this type to a org.jboss.jandex.WildcardType and returns it if the kind is Kind#WILDCARD_TYPE.
pack-priv Type
public static WildcardType.Builder

Returns:

the builder
builder
()

Create a builder of a wildcard type.

pack-priv Type
copyType(AnnotationInstance[] newAnnotations)

Implements abstract org.jboss.jandex.Type.copyType.

pack-priv Type
copyType(Type bound)

public static WildcardType

Returns:

the new instance
create
(Type
the bound (lower or upper)
bound
,
boolean
true if the bound is an upper (extends) bound, false if lower (super)
isExtends
)

Creates a new wildcard type.
public static WildcardType

Returns:

the new instance
createLowerBound
(Type
the lower bound
lowerBound
)

Create a new wildcard type with a lower bound.

public static WildcardType

Returns:

the new instance
createLowerBound
(Class<?>
the lower bound
lowerBound
)

Create a new wildcard type with a lower bound.

public static WildcardType

Returns:

the new instance
createUpperBound
(Type
the upper bound
upperBound
)

Create a new wildcard type with an upper bound.

public static WildcardType

Returns:

the new instance
createUpperBound
(Class<?>
the upper bound
upperBound
)

Create a new wildcard type with an upper bound.

public boolean
equals(Object
the type to compare to
o
)

Overrides org.jboss.jandex.Type.equals.

Compares this Type with another type.
public Type

Returns:

the upper bound, or Object if this wildcard has a lower bound
extendsBound
()

Returns the upper bound of this wildcard (e.g. SomeType for ?

public int
hashCode()

Overrides org.jboss.jandex.Type.hashCode.

Computes a hash code representing this type.
pack-priv boolean
pack-priv boolean
pack-priv int
pack-priv boolean
public Type.Kind
kind()

Implements abstract org.jboss.jandex.Type.kind.

Returns the kind of Type this is.
public DotName
name()

Overrides org.jboss.jandex.Type.name.

Returns the name of this type (or its erasure in case of generic types) as a DotName, using the Class#getName() format.
public Type

Returns:

the lower bound, or null if this wildcard has an uper bound
superBound
()

Returns the lower bound of this wildcard (e.g. SomeType for ?

pack-priv String
toString(boolean simple)

Overrides org.jboss.jandex.Type.toString.

Inherited from org.jboss.jandex.Type:
addAnnotationannotationannotationArrayannotationsannotationsWithRepeatableappendAnnotationsasArrayTypeasClassTypeasParameterizedTypeasPrimitiveTypeasTypeVariableasTypeVariableReferenceasUnresolvedTypeVariableasVoidTypecreatecreateWithAnnotationsdescriptorhasAnnotationtoString

Field Detail

boundback to summary
private final Type bound
hashback to summary
private int hash
isExtendsback to summary
private final boolean isExtends
UNBOUNDEDback to summary
public static final WildcardType UNBOUNDED

A wildcard without a bound, an equivalent of ?.

Since
3.1.0

Constructor Detail

WildcardTypeback to summary
pack-priv WildcardType(Type bound, boolean isExtends)
WildcardTypeback to summary
pack-priv WildcardType(Type bound, boolean isExtends, AnnotationInstance[] annotations)

Method Detail

asWildcardTypeback to summary
public WildcardType asWildcardType()

Overrides org.jboss.jandex.Type.asWildcardType.

Doc from org.jboss.jandex.Type.asWildcardType.

Casts this type to a org.jboss.jandex.WildcardType and returns it if the kind is Kind#WILDCARD_TYPE. Throws an exception otherwise.

Returns:WildcardType

a WildcardType

Annotations
@Override
boundback to summary
pack-priv Type bound()
builderback to summary
public static WildcardType.Builder builder()

Create a builder of a wildcard type.

Returns:WildcardType.Builder

the builder

Since
3.1.0
copyTypeback to summary
pack-priv Type copyType(AnnotationInstance[] newAnnotations)

Implements abstract org.jboss.jandex.Type.copyType.

Annotations
@Override
copyTypeback to summary
pack-priv Type copyType(Type bound)
createback to summary
public static WildcardType create(Type bound, boolean isExtends)

Creates a new wildcard type.

Parameters
bound:Type

the bound (lower or upper)

isExtends:boolean

true if the bound is an upper (extends) bound, false if lower (super)

Returns:WildcardType

the new instance

Annotations
@Deprecated
Since
2.1
createLowerBoundback to summary
public static WildcardType createLowerBound(Type lowerBound)

Create a new wildcard type with a lower bound.

Parameters
lowerBound:Type

the lower bound

Returns:WildcardType

the new instance

Since
3.1.0
createLowerBoundback to summary
public static WildcardType createLowerBound(Class<?> lowerBound)

Create a new wildcard type with a lower bound.

Parameters
lowerBound:Class<?>

the lower bound

Returns:WildcardType

the new instance

Since
3.1.0
createUpperBoundback to summary
public static WildcardType createUpperBound(Type upperBound)

Create a new wildcard type with an upper bound.

Parameters
upperBound:Type

the upper bound

Returns:WildcardType

the new instance

Since
3.1.0
createUpperBoundback to summary
public static WildcardType createUpperBound(Class<?> upperBound)

Create a new wildcard type with an upper bound.

Parameters
upperBound:Class<?>

the upper bound

Returns:WildcardType

the new instance

Since
3.1.0
equalsback to summary
public boolean equals(Object o)

Overrides org.jboss.jandex.Type.equals.

Doc from org.jboss.jandex.Type.equals.

Compares this Type with another type. A type is equal to another type if it is of the same kind, and all of their fields are equal. This includes annotations, which must be equal as well.

Parameters
o:Object

the type to compare to

Returns:boolean

true if equal

Annotations
@Override
extendsBoundback to summary
public Type extendsBound()

Returns the upper bound of this wildcard (e.g. SomeType for ? extends SomeType).

Returns java.lang.Object if this wildcard declares a lower bound (? super SomeType).

Returns:Type

the upper bound, or Object if this wildcard has a lower bound

hashCodeback to summary
public int hashCode()

Overrides org.jboss.jandex.Type.hashCode.

Doc from org.jboss.jandex.Type.hashCode.

Computes a hash code representing this type.

Returns:int

the hash code

Annotations
@Override
hasImplicitObjectBoundback to summary
pack-priv boolean hasImplicitObjectBound()
internEqualsback to summary
pack-priv boolean internEquals(Object o)

Overrides org.jboss.jandex.Type.internEquals.

Annotations
@Override
internHashCodeback to summary
pack-priv int internHashCode()

Overrides org.jboss.jandex.Type.internHashCode.

Annotations
@Override
isExtendsback to summary
pack-priv boolean isExtends()
kindback to summary
public Type.Kind kind()

Implements abstract org.jboss.jandex.Type.kind.

Doc from org.jboss.jandex.Type.kind.

Returns the kind of Type this is.

Returns:Type.Kind

the kind

Annotations
@Override
nameback to summary
public DotName name()

Overrides org.jboss.jandex.Type.name.

Doc from org.jboss.jandex.Type.name.

Returns the name of this type (or its erasure in case of generic types) as a DotName, using the Class#getName() format. Specifically:

  • for primitive types and the void pseudo-type, the corresponding Java keyword is returned (void, boolean, byte, short, int, long, float, double, char);
  • for class types, the binary name of the class is returned;
  • for array types, a string is returned that consists of one or more [ characters corresponding to the number of dimensions of the array type, followed by the element type as a single-character code for primitive types or Lbinary.name.of.TheClass; for class types (for example, [I for int[] or [[Ljava.lang.String; for String[][]);
  • for parameterized types, the binary name of the generic class is returned (for example, java.util.List for List<String>);
  • for type variables, the name of the first bound of the type variable is returned, or java.lang.Object for type variables that have no bound;
  • for wildcard types, the name of the upper bound is returned, or java.lang.Object if the wildcard type does not have an upper bound (for example, java.lang.Number for ? extends Number).
Returns:DotName

the name of this type (or its erasure in case of generic types)

Annotations
@Override
superBoundback to summary
public Type superBound()

Returns the lower bound of this wildcard (e.g. SomeType for ? super SomeType).

Returns null if this wildcard declares an upper bound (? extends SomeType).

Returns:Type

the lower bound, or null if this wildcard has an uper bound

toStringback to summary
pack-priv String toString(boolean simple)

Overrides org.jboss.jandex.Type.toString.

Annotations
@Override
org.jboss.jandex back to summary

public final Class WildcardType.Builder

extends Type.Builder<WildcardType.Builder>
Class Inheritance

Convenient builder for WildcardType.

Note that only one bound may be set. If the setUpperBound() and setLowerBound() methods are called multiple times, only the last call is taken into account; the previously set bounds are ignored.

Since
3.1.0

Field Summary

Modifier and TypeField and Description
private Type
private boolean
Inherited from org.jboss.jandex.Type.Builder:
annotationsname

Constructor Summary

AccessConstructor and Description
pack-priv

Method Summary

Modifier and TypeMethod and Description
public WildcardType

Returns:

the built wildcard type
build
()

Returns the built wildcard type.

public WildcardType.Builder

Returns:

this builder
setLowerBound
(Class<?>
the class whose type is set as the lower bound, must not be null
lowerBound
)

Sets the lower bound.

public WildcardType.Builder

Returns:

this builder
setLowerBound
(Type
the lower bound, must not be null
lowerBound
)

Sets the lower bound.

public WildcardType.Builder

Returns:

this builder
setUpperBound
(Class<?>
the class whose type is set as the upper bound, must not be null
upperBound
)

Sets the upper bound.

public WildcardType.Builder

Returns:

this builder
setUpperBound
(Type
the upper bound, must not be null
upperBound
)

Sets the upper bound.

Inherited from org.jboss.jandex.Type.Builder:
addAnnotationannotationsArrayself

Field Detail

boundback to summary
private Type bound
isExtendsback to summary
private boolean isExtends

Constructor Detail

Builderback to summary
pack-priv Builder()

Method Detail

buildback to summary
public WildcardType build()

Returns the built wildcard type.

Returns:WildcardType

the built wildcard type

setLowerBoundback to summary
public WildcardType.Builder setLowerBound(Class<?> lowerBound)

Sets the lower bound.

Parameters
lowerBound:Class<?>

the class whose type is set as the lower bound, must not be null

Returns:WildcardType.Builder

this builder

setLowerBoundback to summary
public WildcardType.Builder setLowerBound(Type lowerBound)

Sets the lower bound.

Parameters
lowerBound:Type

the lower bound, must not be null

Returns:WildcardType.Builder

this builder

setUpperBoundback to summary
public WildcardType.Builder setUpperBound(Class<?> upperBound)

Sets the upper bound.

Parameters
upperBound:Class<?>

the class whose type is set as the upper bound, must not be null

Returns:WildcardType.Builder

this builder

setUpperBoundback to summary
public WildcardType.Builder setUpperBound(Type upperBound)

Sets the upper bound.

Parameters
upperBound:Type

the upper bound, must not be null

Returns:WildcardType.Builder

this builder