/** * Transforms this type into the lower bound of a wildcard type. * * @param annotations Type annotations to be declared by the wildcard type. * @return A generic type description of a wildcard type with this builder's type as an lower bound. */ public Generic asWildcardLowerBound(Collection<? extends AnnotationDescription> annotations) { return OfWildcardType.Latent.boundedBelow(build(), new Explicit(new ArrayList<AnnotationDescription>(annotations))); }
@Override protected Generic doBuild() { return new Generic.OfTypeVariable.Symbolic(symbol, new Explicit(annotations)); } }
@Override protected Generic doBuild() { return new Generic.OfGenericArray.Latent(componentType, new Explicit(annotations)); } }
@Override protected Generic doBuild() { return new Generic.OfParameterizedType.Latent(rawType, ownerType, parameterTypes, new Explicit(annotations)); } }
@Override protected Generic doBuild() { if (typeDescription.represents(void.class) && !annotations.isEmpty()) { throw new IllegalArgumentException("The void non-type cannot be annotated"); } return new Generic.OfNonGenericType.Latent(typeDescription, ownerType, new Explicit(annotations)); } }
/** * Transforms this type into the upper bound of a wildcard type. * * @param annotations Type annotations to be declared by the wildcard type. * @return A generic type description of a wildcard type with this builder's type as an upper bound. */ public Generic asWildcardUpperBound(Collection<? extends AnnotationDescription> annotations) { return OfWildcardType.Latent.boundedAbove(build(), new Explicit(new ArrayList<AnnotationDescription>(annotations))); }
/** * Creates an unbound wildcard. * * @param annotations The type annotations of the unbound wildcard. * @return A description of an unbound wildcard. */ public static Generic unboundWildcard(Collection<? extends AnnotationDescription> annotations) { return OfWildcardType.Latent.unbounded(new Explicit(new ArrayList<AnnotationDescription>(annotations))); }