Compile Time Annotation Parsing
Annotation which is being primarily used for metadata purposes in Code needs to be parsed to imply the purpose they are intended for. Annotation Parsing is basically done at runtime with Reflections api. This is the usual approach which we generally folow. Apart from the above mentioned fact annotation parsing can also be done at Compile Time and in this post I am going to throw some light into that. Compile Time annotation Parsing follows the SPI (Service Provider Interface) architecture. To achieve this: I have declared a Custom annotation as follows: import java.lang.annotation.Inherited; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; @Inherited @Retention(RetentionPolicy.SOURCE) public @interface CompileTimeParsing { } The main thing to look aout for in the above code is the Retention Policy, which is Source, which is normally Runtime when we use annotation parsing at runtime with Reflections. Now we define the a...