Created
May 25, 2020 17:54
-
-
Save qzagarese/b4b513db4246d2d69527e2d5856f8d97 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Get the handler type from the @Handler annotation | |
Class<? extends AnnotationHandler> handlerType = annotation.annotationType().getAnnotation(Handler.class).value(); | |
// Get and invoke the only constructor (which needs to be an empty one, unless you need a more complex behavior) | |
AnnotationHandler handler = (AnnotationHandler) Stream.of(handlerType.getConstructors()) | |
.findFirst() | |
.get() | |
.newInstance(new Object[0]); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment