Package org.jboss.jandex
Class TypeVariable.Builder
- java.lang.Object
-
- org.jboss.jandex.Type.Builder<TypeVariable.Builder>
-
- org.jboss.jandex.TypeVariable.Builder
-
- Enclosing class:
- TypeVariable
public static final class TypeVariable.Builder extends Type.Builder<TypeVariable.Builder>
Convenient builder forTypeVariable. If no bound is added, the built type variable will have a single bound ofjava.lang.Object.- Since:
- 3.1.0
-
-
Field Summary
Fields Modifier and Type Field Description private java.util.List<Type>boundsprivate booleanhasImplicitObjectBoundprivate java.lang.Stringidentifier-
Fields inherited from class org.jboss.jandex.Type.Builder
annotations, name
-
-
Constructor Summary
Constructors Constructor Description Builder(java.lang.String identifier)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description TypeVariable.BuilderaddBound(java.lang.Class<?> clazz)Adds a bound.TypeVariable.BuilderaddBound(Type bound)Adds a bound.TypeVariablebuild()Returns the built type variable.TypeVariable.BuilderimplicitObjectBound()Marks the built type variable as having an implicit (not declared) bound ofObject.-
Methods inherited from class org.jboss.jandex.Type.Builder
addAnnotation, annotationsArray, self
-
-
-
-
Field Detail
-
identifier
private final java.lang.String identifier
-
bounds
private final java.util.List<Type> bounds
-
hasImplicitObjectBound
private boolean hasImplicitObjectBound
-
-
Method Detail
-
implicitObjectBound
public TypeVariable.Builder implicitObjectBound()
Marks the built type variable as having an implicit (not declared) bound ofObject. It follows that all bounds added viaaddBound(Type), if any, are interface types. The erasure of the type variable is not necessarilyObjectthough; if any interface bounds are added viaaddBound(Type), the first such interface type is the erasure.- Returns:
- this builder
- Since:
- 3.3.2
-
addBound
public TypeVariable.Builder addBound(Type bound)
Adds a bound. The first bound may be a class type or a type variable. If the first bound is a class type (or if the type variable has animplicitObjectBound()), the subsequent bounds must be interface types. If the first bound is a type variable, there may be no subsequent bounds.- Parameters:
bound- the bound, must not benull- Returns:
- this builder
-
addBound
public TypeVariable.Builder addBound(java.lang.Class<?> clazz)
Adds a bound. The first bound may be a class type or a type variable. If the first bound is a class type (or if the type variable has animplicitObjectBound()), the subsequent bounds must be interface types. If the first bound is a type variable, there may be no subsequent bounds.- Parameters:
clazz- the class whose type is added as a bound, must not benull- Returns:
- this builder
-
build
public TypeVariable build()
Returns the built type variable.- Returns:
- the built type variable
-
-