Class TypeDescription.Generic.Builder

java.lang.Object
net.bytebuddy.description.type.TypeDescription.Generic.Builder
Direct Known Subclasses:
TypeDescription.Generic.Builder.OfGenericArrayType, TypeDescription.Generic.Builder.OfNonGenericType, TypeDescription.Generic.Builder.OfParameterizedType, TypeDescription.Generic.Builder.OfTypeVariable
Enclosing interface:
TypeDescription.Generic

@Enhance public abstract static class TypeDescription.Generic.Builder extends Object
A builder for creating describing a generic type as a TypeDescription.Generic.
  • Field Details

    • UNDEFINED

      @AlwaysNull private static final Type UNDEFINED
      Represents an undefined Type within a build step.
    • annotations

      protected final List<? extends AnnotationDescription> annotations
      The type annotations of the current annotated type.
  • Constructor Details

    • Builder

      protected Builder(List<? extends AnnotationDescription> annotations)
      Creates a new builder for a generic type description.
      Parameters:
      annotations - The type annotations of the current annotated type.
  • Method Details

    • of

      public static TypeDescription.Generic.Builder of(Type type)
      Resolves a generic type to a builder of the same type.
      Parameters:
      type - The type to resolve.
      Returns:
      A builder for the given type.
    • of

      public static TypeDescription.Generic.Builder of(TypeDescription.Generic typeDescription)
      Resolves a generic type description to a builder of the same type.
      Parameters:
      typeDescription - The type to resolve.
      Returns:
      A builder for the given type.
    • rawType

      public static TypeDescription.Generic.Builder rawType(Class<?> type)
      Creates a raw type of a type description.
      Parameters:
      type - The type to represent as a raw type.
      Returns:
      A builder for creating a raw type.
    • rawType

      public static TypeDescription.Generic.Builder rawType(TypeDescription type)
      Creates a raw type of a type description.
      Parameters:
      type - The type to represent as a raw type.
      Returns:
      A builder for creating a raw type.
    • rawType

      public static TypeDescription.Generic.Builder rawType(Class<?> type, @MaybeNull TypeDescription.Generic ownerType)
      Creates a raw type of a type description where the supplied owner type is used as .
      Parameters:
      type - The type to represent as a raw type.
      ownerType - The raw type's (annotated) declaring type or null if no owner type should be declared.
      Returns:
      A builder for creating a raw type.
    • rawType

      Creates a raw type of a type description.
      Parameters:
      type - The type to represent as a raw type.
      ownerType - The raw type's (annotated) declaring type or null if no owner type should be declared.
      Returns:
      A builder for creating a raw type.
    • unboundWildcard

      public static TypeDescription.Generic unboundWildcard()
      Creates an unbound wildcard without type annotations.
      Returns:
      A description of an unbound wildcard without type annotations.
    • unboundWildcard

      public static TypeDescription.Generic unboundWildcard(Annotation... annotation)
      Creates an unbound wildcard.
      Parameters:
      annotation - The type annotations of the unbound wildcard.
      Returns:
      A description of an unbound wildcard.
    • unboundWildcard

      public static TypeDescription.Generic unboundWildcard(List<? extends Annotation> annotations)
      Creates an unbound wildcard.
      Parameters:
      annotations - The type annotations of the unbound wildcard.
      Returns:
      A description of an unbound wildcard.
    • unboundWildcard

      public static TypeDescription.Generic unboundWildcard(AnnotationDescription... annotation)
      Creates an unbound wildcard.
      Parameters:
      annotation - The type annotations of the unbound wildcard.
      Returns:
      A description of an unbound wildcard.
    • unboundWildcard

      public static TypeDescription.Generic unboundWildcard(Collection<? extends AnnotationDescription> annotations)
      Creates an unbound wildcard.
      Parameters:
      annotations - The type annotations of the unbound wildcard.
      Returns:
      A description of an unbound wildcard.
    • typeVariable

      public static TypeDescription.Generic.Builder typeVariable(String symbol)
      Creates a symbolic type variable of the given name.
      Parameters:
      symbol - The symbolic name of the type variable.
      Returns:
      A builder for creating a type variable.
    • parameterizedType

      public static TypeDescription.Generic.Builder parameterizedType(Class<?> rawType, Type... parameter)
      Creates a parameterized type without an owner type or with a non-generic owner type.
      Parameters:
      rawType - A raw version of the type to describe as a parameterized type.
      parameter - The type arguments to attach to the raw type as parameters.
      Returns:
      A builder for creating a parameterized type.
    • parameterizedType

      public static TypeDescription.Generic.Builder parameterizedType(Class<?> rawType, List<? extends Type> parameters)
      Creates a parameterized type without an owner type or with a non-generic owner type.
      Parameters:
      rawType - A raw version of the type to describe as a parameterized type.
      parameters - The type arguments to attach to the raw type as parameters.
      Returns:
      A builder for creating a parameterized type.
    • parameterizedType

      public static TypeDescription.Generic.Builder parameterizedType(Class<?> rawType, @MaybeNull Type ownerType, List<? extends Type> parameters)
      Creates a parameterized type.
      Parameters:
      rawType - A raw version of the type to describe as a parameterized type.
      ownerType - The owner type of the parameterized type.
      parameters - The type arguments to attach to the raw type as parameters.
      Returns:
      A builder for creating a parameterized type.
    • parameterizedType

      public static TypeDescription.Generic.Builder parameterizedType(TypeDescription rawType, TypeDefinition... parameter)
      Creates a parameterized type without an owner type or with a non-generic owner type.
      Parameters:
      rawType - A raw version of the type to describe as a parameterized type.
      parameter - The type arguments to attach to the raw type as parameters.
      Returns:
      A builder for creating a parameterized type.
    • parameterizedType

      public static TypeDescription.Generic.Builder parameterizedType(TypeDescription rawType, Collection<? extends TypeDefinition> parameters)
      Creates a parameterized type without an owner type or with a non-generic owner type.
      Parameters:
      rawType - A raw version of the type to describe as a parameterized type.
      parameters - The type arguments to attach to the raw type as parameters.
      Returns:
      A builder for creating a parameterized type.
    • parameterizedType

      public static TypeDescription.Generic.Builder parameterizedType(TypeDescription rawType, @MaybeNull TypeDescription.Generic ownerType, Collection<? extends TypeDefinition> parameters)
      Creates a parameterized type.
      Parameters:
      rawType - A raw version of the type to describe as a parameterized type.
      ownerType - The owner type of the parameterized type.
      parameters - The type arguments to attach to the raw type as parameters.
      Returns:
      A builder for creating a parameterized type.
    • asWildcardUpperBound

      public TypeDescription.Generic asWildcardUpperBound()
      Transforms this type into the upper bound of a wildcard type.
      Returns:
      A generic type description of a wildcard type with this builder's type as an upper bound.
    • asWildcardUpperBound

      public TypeDescription.Generic asWildcardUpperBound(Annotation... annotation)
      Transforms this type into the upper bound of a wildcard type.
      Parameters:
      annotation - Type annotations to be declared by the wildcard type.
      Returns:
      A generic type description of a wildcard type with this builder's type as an upper bound.
    • asWildcardUpperBound

      public TypeDescription.Generic asWildcardUpperBound(List<? extends Annotation> annotations)
      Transforms this type into the upper bound of a wildcard type.
      Parameters:
      annotations - Type annotations to be declared by the wildcard type.
      Returns:
      A generic type description of a wildcard type with this builder's type as an upper bound.
    • asWildcardUpperBound

      public TypeDescription.Generic asWildcardUpperBound(AnnotationDescription... annotation)
      Transforms this type into the upper bound of a wildcard type.
      Parameters:
      annotation - Type annotations to be declared by the wildcard type.
      Returns:
      A generic type description of a wildcard type with this builder's type as an upper bound.
    • asWildcardUpperBound

      public TypeDescription.Generic asWildcardUpperBound(Collection<? extends AnnotationDescription> annotations)
      Transforms this type into the upper bound of a wildcard type.
      Parameters:
      annotations - Type annotations to be declared by the wildcard type.
      Returns:
      A generic type description of a wildcard type with this builder's type as an upper bound.
    • asWildcardLowerBound

      public TypeDescription.Generic asWildcardLowerBound()
      Transforms this type into the lower bound of a wildcard type.
      Returns:
      A generic type description of a wildcard type with this builder's type as an lower bound.
    • asWildcardLowerBound

      public TypeDescription.Generic asWildcardLowerBound(Annotation... annotation)
      Transforms this type into the lower bound of a wildcard type.
      Parameters:
      annotation - Type annotations to be declared by the wildcard type.
      Returns:
      A generic type description of a wildcard type with this builder's type as an lower bound.
    • asWildcardLowerBound

      public TypeDescription.Generic asWildcardLowerBound(List<? extends Annotation> annotations)
      Transforms this type into the lower bound of a wildcard type.
      Parameters:
      annotations - Type annotations to be declared by the wildcard type.
      Returns:
      A generic type description of a wildcard type with this builder's type as an lower bound.
    • asWildcardLowerBound

      public TypeDescription.Generic asWildcardLowerBound(AnnotationDescription... annotation)
      Transforms this type into the lower bound of a wildcard type.
      Parameters:
      annotation - Type annotations to be declared by the wildcard type.
      Returns:
      A generic type description of a wildcard type with this builder's type as an lower bound.
    • asWildcardLowerBound

      public TypeDescription.Generic asWildcardLowerBound(Collection<? extends AnnotationDescription> annotations)
      Transforms this type into the lower bound of a wildcard type.
      Parameters:
      annotations - Type annotations to be declared by the wildcard type.
      Returns:
      A generic type description of a wildcard type with this builder's type as an lower bound.
    • asArray

      Represents the built type into an array.
      Returns:
      A builder for creating an array of the currently built type.
    • asArray

      public TypeDescription.Generic.Builder asArray(int arity)
      Represents the built type into an array.
      Parameters:
      arity - The arity of the array.
      Returns:
      A builder for creating an array of the currently built type.
    • annotate

      public TypeDescription.Generic.Builder annotate(Annotation... annotation)
      Defines type annotations to be declared by the current type.
      Parameters:
      annotation - Type annotations to be declared by the current type.
      Returns:
      A new builder where the current type declares the supplied type annotations.
    • annotate

      public TypeDescription.Generic.Builder annotate(List<? extends Annotation> annotations)
      Defines type annotations to be declared by the current type.
      Parameters:
      annotations - Type annotations to be declared by the current type.
      Returns:
      A new builder where the current type declares the supplied type annotations.
    • annotate

      public TypeDescription.Generic.Builder annotate(AnnotationDescription... annotation)
      Defines type annotations to be declared by the current type.
      Parameters:
      annotation - Type annotations to be declared by the current type.
      Returns:
      A new builder where the current type declares the supplied type annotations.
    • annotate

      public TypeDescription.Generic.Builder annotate(Collection<? extends AnnotationDescription> annotations)
      Defines type annotations to be declared by the current type.
      Parameters:
      annotations - Type annotations to be declared by the current type.
      Returns:
      A new builder where the current type declares the supplied type annotations.
    • doAnnotate

      protected abstract TypeDescription.Generic.Builder doAnnotate(List<? extends AnnotationDescription> annotations)
      Creates a new builder for the current type and the applied type annotations.
      Parameters:
      annotations - Type annotations to be declared by the current type.
      Returns:
      A new builder where the current type declares the supplied type annotations.
    • build

      public TypeDescription.Generic build()
      Finalizes the build and finalizes the created type as a generic type description.
      Returns:
      A generic type description of the built type.
    • build

      public TypeDescription.Generic build(Annotation... annotation)
      Finalizes the build and finalizes the created type as a generic type description.
      Parameters:
      annotation - Type annotations place for the built generic type to declare.
      Returns:
      A generic type description of the built type.
    • build

      public TypeDescription.Generic build(List<? extends Annotation> annotations)
      Finalizes the build and finalizes the created type as a generic type description.
      Parameters:
      annotations - Type annotations place for the built generic type to declare.
      Returns:
      A generic type description of the built type.
    • build

      public TypeDescription.Generic build(AnnotationDescription... annotation)
      Finalizes the build and finalizes the created type as a generic type description.
      Parameters:
      annotation - Type annotations place for the built generic type to declare.
      Returns:
      A generic type description of the built type.
    • build

      public TypeDescription.Generic build(Collection<? extends AnnotationDescription> annotations)
      Finalizes the build and finalizes the created type as a generic type description.
      Parameters:
      annotations - Type annotations place for the built generic type to declare.
      Returns:
      A generic type description of the built type.
    • doBuild

      protected abstract TypeDescription.Generic doBuild()
      Builds the generic type.
      Returns:
      The generic type.