@Retention: This can be used to specify if my custom annotation should be available at runtime, for inspection via reflection.
You use RUNTIME retention when you want your program to make decisions based on annotations while it is executing.
Imagine you have a class with 10 methods, but for a specific user (e.g., a “Free Tier” user), you don’t want them to run the deleteDatabase method or the exportCSV method. You could write hundreds of if statements, OR you could use an annotation.
@Target: To specify which Java elements my custom annotation can be used to annotate
@Target({ElementType.METHOD})
Types of ElementType:
ElementType.ANNOTATION_TYPE
ElementType.CONSTRUCTOR
ElementType.FIELD
ElementType.LOCAL_VARIABLE
ElementType.METHOD
ElementType.PACKAGE
ElementType.PARAMETER
ElementType.TYPE
ElementType.TYPE_PARAMETER
ElementType.TYPE_USE
@Inherited: A custom java annotation used in a class should be inherited by subclasses inheriting from that class.
@Documented: Signal to JavaDoc that my custom annotation should be visible in the JavaDoc for classes using it.
TODO: What is JavaDoc? How does it work