Class TypeDescription.Generic.Builder

    • Field Detail

      • UNDEFINED

        private static final java.lang.reflect.Type UNDEFINED
        Represents an undefined Type within 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 or null if 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 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​(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.