@SafeVarargs public final ArgResolver annotPresent(Class<? extends Annotation>... annotationTypes) { return new ArgResolver().annotPresent(annotationTypes); }
/** * Filter on method arguments that don't have the given annotation type(s). * @param annotationTypes the annotation types */ @SafeVarargs public final ArgResolver annotNotPresent(Class<? extends Annotation>... annotationTypes) { return new ArgResolver().annotNotPresent(annotationTypes); }
/** * Resolve the argument. */ public final MethodParameter arg() { List<MethodParameter> matches = applyFilters(); Assert.state(!matches.isEmpty(), () -> "No matching arg in method\n" + formatMethod()); Assert.state(matches.size() == 1, () -> "Multiple matching args in method\n" + formatMethod() + "\nMatches:\n\t" + matches); return matches.get(0); }
/** * Resolve the argument also matching to the given type. * @param type the expected type */ public MethodParameter arg(ResolvableType type) { this.filters.add(p -> type.toString().equals(ResolvableType.forMethodParameter(p).toString())); return arg(); }
/** * Filter on method arguments with annotation. */ @SafeVarargs public final ArgResolver annot(Predicate<MethodParameter>... filter) { return new ArgResolver(filter); }
/** * Resolve the argument also matching to the given type. * @param type the expected type */ public MethodParameter arg(Class<?> type, ResolvableType generic, ResolvableType... generics) { return arg(toResolvableType(type, generic, generics)); }
/** * Find a unique argument matching the given type. * @param type the expected type * @param generic at least one generic type * @param generics optional array of generic types */ public MethodParameter arg(Class<?> type, ResolvableType generic, ResolvableType... generics) { return new ArgResolver().arg(type, generic, generics); }
/** * Resolve the argument also matching to the given type. * @param type the expected type */ public MethodParameter arg(Class<?> type, Class<?>... generics) { return arg(toResolvableType(type, generics)); }
/** * Find a unique argument matching the given type. * @param type the expected type * @param generics optional array of generic types */ public MethodParameter arg(Class<?> type, Class<?>... generics) { return new ArgResolver().arg(type, generics); }
/** * Find a unique argument matching the given type. * @param type the expected type */ public MethodParameter arg(ResolvableType type) { return new ArgResolver().arg(type); }