/** * Represents the built type into an array. * * @param arity The arity of the array. * @return A builder for creating an array of the currently built type. */ public Builder asArray(int arity) { if (arity < 1) { throw new IllegalArgumentException("Cannot define an array of a non-positive arity: " + arity); } TypeDescription.Generic typeDescription = build(); while (--arity > 0) { typeDescription = new OfGenericArray.Latent(typeDescription, Empty.INSTANCE); } return new Builder.OfGenericArrayType(typeDescription); }
/** * {@inheritDoc} */ public Generic onNonGenericType(Generic typeDescription) { return typeDescription.isArray() ? new OfGenericArray.Latent(typeDescription.getComponentType().accept(this), typeDescription) : onSimpleType(typeDescription); }
/** * {@inheritDoc} */ public Generic onGenericArray(Generic genericArray) { return new OfGenericArray.Latent(genericArray.getComponentType().accept(this), genericArray); }
/** * {@inheritDoc} */ public Generic onGenericArray(Generic genericArray) { return new OfGenericArray.Latent(genericArray.getComponentType().accept(this), Empty.INSTANCE); }
@Override protected Generic doBuild() { return new Generic.OfGenericArray.Latent(componentType, new Explicit(annotations)); } }
/** * {@inheritDoc} */ public Generic onNonGenericType(Generic typeDescription) { return typeDescription.isArray() ? new OfGenericArray.Latent(onNonGenericType(typeDescription.getComponentType()), Empty.INSTANCE) : new OfNonGenericType.Latent(typeDescription.asErasure(), Empty.INSTANCE); }