/** * Creates a new argument representing a generic set. * * @param type set element type * @param <T> set element type * @return The argument instance */ static <T> Argument<Set<T>> setOf(Class<T> type) { //noinspection unchecked return of((Class<Set<T>>) ((Class) Set.class), type); }
/** * Create a new {@link ArgumentValue} for the given {@link Argument} and value. * * @param argument The argument * @param value The value * @param <T> The value type * @return The created instance */ static <T> ArgumentValue<T> create(Argument<T> argument, T value) { return new DefaultArgumentValue<>(argument, value); } }
/** * Create a new {@link MutableArgumentValue} for the given {@link Argument} and value. * * @param argument The argument * @param value The value * @param <T> The value type * @return The created instance */ static <T> MutableArgumentValue<T> create(Argument<T> argument, T value) { return new DefaultMutableArgumentValue<>(argument, value); } }
@Override public String getName() { return argument.getName(); }
@Override public Class<V> getType() { return argument.getType(); }
@Override public AnnotationMetadata getAnnotationMetadata() { return argument.getAnnotationMetadata(); } }
@Override public Optional<Argument<?>> getFirstTypeVariable() { return argument.getFirstTypeVariable(); }
@Override public Map<String, Argument<?>> getTypeVariables() { return argument.getTypeVariables(); }
@Override public Argument[] getTypeParameters() { return argument.getTypeParameters(); }
@Override public boolean equalsType(Argument<?> o) { return argument.equalsType(o); }
@Override public int typeHashCode() { return argument.typeHashCode(); }
/** * @param type The type * @param name The name * @param annotationMetadata The annotation metadata * @param genericTypes The generic types */ public DefaultArgument(Class<T> type, String name, AnnotationMetadata annotationMetadata, Argument... genericTypes) { this.type = type; this.name = name; this.annotationMetadata = annotationMetadata != null ? annotationMetadata : AnnotationMetadata.EMPTY_METADATA; this.typeParameters = initializeTypeParameters(genericTypes); this.typeParameterArray = genericTypes; }
@Override public Annotation[] synthesizeAll() { return argument.synthesizeAll(); }
@Override public <T extends Annotation> T synthesize(Class<T> annotationClass) { return argument.synthesize(annotationClass); }
@Override public Annotation[] synthesizeDeclared() { return argument.synthesizeDeclared(); }
/** * Creates a new argument representing a generic list. * * @param type list element type * @param <T> list element type * @return The argument instance */ static <T> Argument<List<T>> listOf(Class<T> type) { //noinspection unchecked return of((Class<List<T>>) ((Class) List.class), type); }
@Override public Map<String, Argument<?>> getTypeVariables() { return argument.getTypeVariables(); }
@Override public Argument[] getTypeParameters() { return argument.getTypeParameters(); }
@Override public Argument<CompletableFuture> argumentType() { return Argument.of(CompletableFuture.class); }
@Override public Argument<Publisher> argumentType() { return Argument.of(Publisher.class); }