Reflection to Extract Annotation Details

In my this tutorial, I am going to demonstrate how to extract method details with Annotation details with Reflection mechanism.  Have a look on complete details and let me know if I you need some more details.

 

Below interface is @Retention.RUNTIME Annotation enabled. 

 

 

 

In below method, I tried to showcase different types of Annotations in order to distinguish at Reflection class in RefTestReflection class.

 

 

Below class showcase what all methods are from Annotated class and how many from without Annotated class. We are using reflection mechanism to find out methods details.

 

Reflection for Extracting Method Info

 

 

 

Have a look on below method listing. “Dummy Methods” will fall in “else” part and “@Annotated Methods” will fall under “if” block.  

 

 

 

@Annotations

  1. Annotations and Its Benefits in Java
  2. Advantages Of Annotations Over XML
  3. Annotation Programming Basics
  4. Annotation Types
    1. Simple Annotation
    2. Meta Annotation
      1. Meta ‘Target’ Annotation
      2. Meta ‘Retention’ Annotation
      3. Meta ‘Documented’ Annotation
      4. Meta ‘Inherited’ Annotation
  5. Reflection to Extract Annotation Details

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.