Class TypeVariable.Builder

java.lang.Object
org.jboss.jandex.TypeVariable.Builder
Enclosing class:
TypeVariable

public static final class TypeVariable.Builder extends Object
Convenient builder for TypeVariable. If no bound is added, the built type variable will have a single bound of java.lang.Object.
Since:
3.1.0
  • Field Details

  • Method Details

    • implicitObjectBound

      public TypeVariable.Builder implicitObjectBound()
      Marks the built type variable as having an implicit (not declared) bound of Object. It follows that all bounds added via addBound(Type), if any, are interface types. The erasure of the type variable is not necessarily Object though; if any interface bounds are added via addBound(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 an implicitObjectBound()), 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 be null
      Returns:
      this builder
    • addBound

      public TypeVariable.Builder addBound(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 an implicitObjectBound()), 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 be null
      Returns:
      this builder
    • build

      public TypeVariable build()
      Returns the built type variable.
      Returns:
      the built type variable
    • self

      protected TypeVariable.Builder self()
    • annotationsArray

      protected AnnotationInstance[] annotationsArray()
      Returns:
      the annotations array or null if no annotation was specified
    • addAnnotation

      public TypeVariable.Builder addAnnotation(AnnotationInstance annotation)
      Adds an annotation to the type being created by this builder. Note that it becomes a type annotation.
      Parameters:
      annotation - the annotation instance; can be created using AnnotationInstance.builder()
      Returns:
      this builder
      See Also: