How to get the value of annotation using Reflection in Java
annotations, java, reflection
Solution
Here the some way to get annotation,
Class<?> cls = Class.forName(name);
cls.getDeclaredAnnotations(); // get all annotation
(cls.getDeclaredMethods()[0]).getAnnotations(); //get annotation of a method
Annotation ety = cls.getAnnotation(Annotation.class); // get annotation of particular annotation class
Problem
How can I get the value of the annotation using Java `Reflection` ? This is the annotated method: ``` @JsonView( { View.class } ) public Element getElement() { return element; } ```