Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
// Convert annotations on each method's params
clazz.getMethods().stream()
.map(CallableDeclaration::getParameters)
.flatMap(Collection::stream)
.map(Parameter::getAnnotations)
.flatMap(Collection::stream)
.forEach(converter);
// Convert annotations on each method's params
clazz.getMethods().stream()
.flatMap(method -> method.getParameters().stream())
.flatMap(parameter -> parameter.getAnnotations().stream())
.forEach(converter);
// Assumes Stream has a method signature similar to:
// default <R> Stream<R> flatMap(Collection<? extends R> collection) {
// return collection.stream();
// }
// Convert annotations on each method's params
clazz.getMethods().stream()
.flatMap(CallableDeclaration::getParameters)
.flatMap(Parameter::getAnnotations)
.forEach(converter);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment