Package net.bytebuddy.description.type
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
A builder for creating describing a generic type as a
TypeDescription.Generic
.-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprotected static class
A generic type builder building a generic array type.protected static class
A generic type builder for building a non-generic type.protected static class
A generic type builder for building a parameterized type.protected static class
A generic type builder building a symbolic type variable.protected static enum
A visitor to resolve a generic type to aTypeDescription.Generic.Builder
. -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final List<? extends AnnotationDescription>
The type annotations of the current annotated type.private static final Type
Represents an undefinedType
within a build step. -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotected
Builder
(List<? extends AnnotationDescription> annotations) Creates a new builder for a generic type description. -
Method Summary
Modifier and TypeMethodDescriptionannotate
(Annotation... annotation) Defines type annotations to be declared by the current type.annotate
(Collection<? extends AnnotationDescription> annotations) Defines type annotations to be declared by the current type.annotate
(List<? extends Annotation> annotations) Defines type annotations to be declared by the current type.annotate
(AnnotationDescription... annotation) Defines type annotations to be declared by the current type.asArray()
Represents the built type into an array.asArray
(int arity) Represents the built type into an array.Transforms this type into the lower bound of a wildcard type.asWildcardLowerBound
(Annotation... annotation) Transforms this type into the lower bound of a wildcard type.asWildcardLowerBound
(Collection<? extends AnnotationDescription> annotations) Transforms this type into the lower bound of a wildcard type.asWildcardLowerBound
(List<? extends Annotation> annotations) Transforms this type into the lower bound of a wildcard type.asWildcardLowerBound
(AnnotationDescription... annotation) Transforms this type into the lower bound of a wildcard type.Transforms this type into the upper bound of a wildcard type.asWildcardUpperBound
(Annotation... annotation) Transforms this type into the upper bound of a wildcard type.asWildcardUpperBound
(Collection<? extends AnnotationDescription> annotations) Transforms this type into the upper bound of a wildcard type.asWildcardUpperBound
(List<? extends Annotation> annotations) Transforms this type into the upper bound of a wildcard type.asWildcardUpperBound
(AnnotationDescription... annotation) Transforms this type into the upper bound of a wildcard type.build()
Finalizes the build and finalizes the created type as a generic type description.build
(Annotation... annotation) Finalizes the build and finalizes the created type as a generic type description.build
(Collection<? extends AnnotationDescription> annotations) Finalizes the build and finalizes the created type as a generic type description.build
(List<? extends Annotation> annotations) Finalizes the build and finalizes the created type as a generic type description.build
(AnnotationDescription... annotation) Finalizes the build and finalizes the created type as a generic type description.protected abstract TypeDescription.Generic.Builder
doAnnotate
(List<? extends AnnotationDescription> annotations) Creates a new builder for the current type and the applied type annotations.protected abstract TypeDescription.Generic
doBuild()
Builds the generic type.Resolves a generic type to a builder of the same type.of
(TypeDescription.Generic typeDescription) Resolves a generic type description to a builder of the same type.parameterizedType
(Class<?> rawType, Type... parameter) Creates a parameterized type without an owner type or with a non-generic owner type.parameterizedType
(Class<?> rawType, Type ownerType, List<? extends Type> parameters) Creates a parameterized type.parameterizedType
(Class<?> rawType, List<? extends Type> parameters) Creates a parameterized type without an owner type or with a non-generic owner type.parameterizedType
(TypeDescription rawType, Collection<? extends TypeDefinition> parameters) Creates a parameterized type without an owner type or with a non-generic owner type.parameterizedType
(TypeDescription rawType, TypeDefinition... parameter) Creates a parameterized type without an owner type or with a non-generic owner type.parameterizedType
(TypeDescription rawType, TypeDescription.Generic ownerType, Collection<? extends TypeDefinition> parameters) Creates a parameterized type.Creates a raw type of a type description.rawType
(Class<?> type, TypeDescription.Generic ownerType) Creates a raw type of a type description where the supplied owner type is used as .rawType
(TypeDescription type) Creates a raw type of a type description.rawType
(TypeDescription type, TypeDescription.Generic ownerType) Creates a raw type of a type description.typeVariable
(String symbol) Creates a symbolic type variable of the given name.static TypeDescription.Generic
Creates an unbound wildcard without type annotations.static TypeDescription.Generic
unboundWildcard
(Annotation... annotation) Creates an unbound wildcard.static TypeDescription.Generic
unboundWildcard
(Collection<? extends AnnotationDescription> annotations) Creates an unbound wildcard.static TypeDescription.Generic
unboundWildcard
(List<? extends Annotation> annotations) Creates an unbound wildcard.static TypeDescription.Generic
unboundWildcard
(AnnotationDescription... annotation) Creates an unbound wildcard.
-
Field Details
-
UNDEFINED
Represents an undefinedType
within a build step. -
annotations
The type annotations of the current annotated type.
-
-
Constructor Details
-
Builder
Creates a new builder for a generic type description.- Parameters:
annotations
- The type annotations of the current annotated type.
-
-
Method Details
-
of
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
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
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
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 ornull
if no owner type should be declared.- Returns:
- A builder for creating a raw type.
-
rawType
public static TypeDescription.Generic.Builder rawType(TypeDescription type, @MaybeNull TypeDescription.Generic ownerType) 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 ornull
if no owner type should be declared.- Returns:
- A builder for creating a raw type.
-
unboundWildcard
Creates an unbound wildcard without type annotations.- Returns:
- A description of an unbound wildcard without type annotations.
-
unboundWildcard
Creates an unbound wildcard.- Parameters:
annotation
- The type annotations of the unbound wildcard.- Returns:
- A description of an unbound wildcard.
-
unboundWildcard
Creates an unbound wildcard.- Parameters:
annotations
- The type annotations of the unbound wildcard.- Returns:
- A description of an unbound wildcard.
-
unboundWildcard
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
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
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
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
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
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
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
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
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
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
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
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
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
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
Finalizes the build and finalizes the created type as a generic type description.- Returns:
- A generic type description of the built type.
-
build
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
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
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
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
Builds the generic type.- Returns:
- The generic type.
-