Skip to content

Instantly share code, notes, and snippets.

@dblevins
Last active April 8, 2018 23:32
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dblevins/d8f36dd35e99a90a5d994de609dcde48 to your computer and use it in GitHub Desktop.
Save dblevins/d8f36dd35e99a90a5d994de609dcde48 to your computer and use it in GitHub Desktop.
// 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