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
@Enhance public abstract static class TypeDescription.Generic.Builder extends java.lang.Object
A builder for creating describing a generic type as aTypeDescription.Generic.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description protected static classTypeDescription.Generic.Builder.OfGenericArrayTypeA generic type builder building a generic array type.protected static classTypeDescription.Generic.Builder.OfNonGenericTypeA generic type builder for building a non-generic type.protected static classTypeDescription.Generic.Builder.OfParameterizedTypeA generic type builder for building a parameterized type.protected static classTypeDescription.Generic.Builder.OfTypeVariableA generic type builder building a symbolic type variable.
-
Field Summary
Fields Modifier and Type Field Description protected java.util.List<? extends AnnotationDescription>annotationsThe type annotations of the current annotated type.private static java.lang.reflect.TypeUNDEFINEDRepresents an undefinedTypewithin a build step.
-
Constructor Summary
Constructors Modifier Constructor Description protectedBuilder(java.util.List<? extends AnnotationDescription> annotations)Creates a new builder for a generic type description.
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description TypeDescription.Generic.Builderannotate(java.lang.annotation.Annotation... annotation)Defines type annotations to be declared by the current type.TypeDescription.Generic.Builderannotate(java.util.Collection<? extends AnnotationDescription> annotations)Defines type annotations to be declared by the current type.TypeDescription.Generic.Builderannotate(java.util.List<? extends java.lang.annotation.Annotation> annotations)Defines type annotations to be declared by the current type.TypeDescription.Generic.Builderannotate(AnnotationDescription... annotation)Defines type annotations to be declared by the current type.TypeDescription.Generic.BuilderasArray()Represents the built type into an array.TypeDescription.Generic.BuilderasArray(int arity)Represents the built type into an array.TypeDescription.GenericasWildcardLowerBound()Transforms this type into the lower bound of a wildcard type.TypeDescription.GenericasWildcardLowerBound(java.lang.annotation.Annotation... annotation)Transforms this type into the lower bound of a wildcard type.TypeDescription.GenericasWildcardLowerBound(java.util.Collection<? extends AnnotationDescription> annotations)Transforms this type into the lower bound of a wildcard type.TypeDescription.GenericasWildcardLowerBound(java.util.List<? extends java.lang.annotation.Annotation> annotations)Transforms this type into the lower bound of a wildcard type.TypeDescription.GenericasWildcardLowerBound(AnnotationDescription... annotation)Transforms this type into the lower bound of a wildcard type.TypeDescription.GenericasWildcardUpperBound()Transforms this type into the upper bound of a wildcard type.TypeDescription.GenericasWildcardUpperBound(java.lang.annotation.Annotation... annotation)Transforms this type into the upper bound of a wildcard type.TypeDescription.GenericasWildcardUpperBound(java.util.Collection<? extends AnnotationDescription> annotations)Transforms this type into the upper bound of a wildcard type.TypeDescription.GenericasWildcardUpperBound(java.util.List<? extends java.lang.annotation.Annotation> annotations)Transforms this type into the upper bound of a wildcard type.TypeDescription.GenericasWildcardUpperBound(AnnotationDescription... annotation)Transforms this type into the upper bound of a wildcard type.TypeDescription.Genericbuild()Finalizes the build and finalizes the created type as a generic type description.TypeDescription.Genericbuild(java.lang.annotation.Annotation... annotation)Finalizes the build and finalizes the created type as a generic type description.TypeDescription.Genericbuild(java.util.Collection<? extends AnnotationDescription> annotations)Finalizes the build and finalizes the created type as a generic type description.TypeDescription.Genericbuild(java.util.List<? extends java.lang.annotation.Annotation> annotations)Finalizes the build and finalizes the created type as a generic type description.TypeDescription.Genericbuild(AnnotationDescription... annotation)Finalizes the build and finalizes the created type as a generic type description.protected abstract TypeDescription.Generic.BuilderdoAnnotate(java.util.List<? extends AnnotationDescription> annotations)Creates a new builder for the current type and the applied type annotations.protected abstract TypeDescription.GenericdoBuild()Builds the generic type.static TypeDescription.Generic.BuilderparameterizedType(java.lang.Class<?> rawType, java.lang.reflect.Type... parameter)Creates a parameterized type without an owner type or with a non-generic owner type.static TypeDescription.Generic.BuilderparameterizedType(java.lang.Class<?> rawType, java.lang.reflect.Type ownerType, java.util.List<? extends java.lang.reflect.Type> parameters)Creates a parameterized type.static TypeDescription.Generic.BuilderparameterizedType(java.lang.Class<?> rawType, java.util.List<? extends java.lang.reflect.Type> parameters)Creates a parameterized type without an owner type or with a non-generic owner type.static TypeDescription.Generic.BuilderparameterizedType(TypeDescription rawType, java.util.Collection<? extends TypeDefinition> parameters)Creates a parameterized type without an owner type or with a non-generic owner type.static TypeDescription.Generic.BuilderparameterizedType(TypeDescription rawType, TypeDefinition... parameter)Creates a parameterized type without an owner type or with a non-generic owner type.static TypeDescription.Generic.BuilderparameterizedType(TypeDescription rawType, TypeDescription.Generic ownerType, java.util.Collection<? extends TypeDefinition> parameters)Creates a parameterized type.static TypeDescription.Generic.BuilderrawType(java.lang.Class<?> type)Creates a raw type of a type description.static TypeDescription.Generic.BuilderrawType(java.lang.Class<?> type, TypeDescription.Generic ownerType)Creates a raw type of a type description where the supplied owner type is used as .static TypeDescription.Generic.BuilderrawType(TypeDescription type)Creates a raw type of a type description.static TypeDescription.Generic.BuilderrawType(TypeDescription type, TypeDescription.Generic ownerType)Creates a raw type of a type description.static TypeDescription.Generic.BuildertypeVariable(java.lang.String symbol)Creates a symbolic type variable of the given name.static TypeDescription.GenericunboundWildcard()Creates an unbound wildcard without type annotations.static TypeDescription.GenericunboundWildcard(java.lang.annotation.Annotation... annotation)Creates an unbound wildcard.static TypeDescription.GenericunboundWildcard(java.util.Collection<? extends AnnotationDescription> annotations)Creates an unbound wildcard.static TypeDescription.GenericunboundWildcard(java.util.List<? extends java.lang.annotation.Annotation> annotations)Creates an unbound wildcard.static TypeDescription.GenericunboundWildcard(AnnotationDescription... annotation)Creates an unbound wildcard.
-
-
-
Field Detail
-
UNDEFINED
private static final java.lang.reflect.Type UNDEFINED
Represents an undefinedTypewithin a build step.
-
annotations
protected final java.util.List<? extends AnnotationDescription> annotations
The type annotations of the current annotated type.
-
-
Constructor Detail
-
Builder
protected Builder(java.util.List<? extends AnnotationDescription> annotations)
Creates a new builder for a generic type description.- Parameters:
annotations- The type annotations of the current annotated type.
-
-
Method Detail
-
rawType
public static TypeDescription.Generic.Builder rawType(java.lang.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(java.lang.Class<?> type, 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 ornullif no owner type should be declared.- Returns:
- A builder for creating a raw type.
-
rawType
public static TypeDescription.Generic.Builder rawType(TypeDescription type, 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 ornullif 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(java.lang.annotation.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(java.util.List<? extends java.lang.annotation.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(java.util.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(java.lang.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(java.lang.Class<?> rawType, java.lang.reflect.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(java.lang.Class<?> rawType, java.util.List<? extends java.lang.reflect.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(java.lang.Class<?> rawType, java.lang.reflect.Type ownerType, java.util.List<? extends java.lang.reflect.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, java.util.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, TypeDescription.Generic ownerType, java.util.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(java.lang.annotation.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(java.util.List<? extends java.lang.annotation.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(java.util.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(java.lang.annotation.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(java.util.List<? extends java.lang.annotation.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(java.util.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
public TypeDescription.Generic.Builder 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(java.lang.annotation.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(java.util.List<? extends java.lang.annotation.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(java.util.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(java.util.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(java.lang.annotation.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(java.util.List<? extends java.lang.annotation.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(java.util.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.
-
-