- Get class instance using getClass()
- Assign annotated method from class instance using
runtimeClass.getMethod(). - Get annotation instance using
method.getAnnotation().
SOURCE:
AuthorInfo.java SOURCE:
ReadAnnotationRuntime.java OUTPUT:
Name :becbe Description :A unique source for Java developers
You can also read
- Introduction to Java Annotations
- How to write custom annotation
- Writing custom Annotation with RentionPolicy
- How read annotation at runtime using Java Reflection
- How to list out annotations used in a class using Java Reflection
- How to create custom annotation with default values
- How to create Marker Annotation using java
0 comments :
Post a Comment