How to create optional parameters for own annotations?

Solution 1:

Seems like the first example in the official documentation says it all ...

/**
 * Describes the Request-For-Enhancement(RFE) that led
 * to the presence of the annotated API element.
 */
public @interface RequestForEnhancement {
    int    id();
    String synopsis();
    String engineer() default "[unassigned]"; 
    String date()     default "[unimplemented]"; 
}

Solution 2:

To make it optional you can assign it a default value like that:

public @interface ColumnName {
   String value();
   String datatype() default "String";
 }

Then it doesn't need to be specified when using the Annotation.