...
- or you define aliases (shortcuts/abbreviations), for the annotations and map these to the fully qualified class names for the annotation interfaces. This is done using the
annotations.propertiesfile.
Example:
If we now feed this property file to the compiler we are able to write the annotations like this instead:Code Block java OneWay = org.codehaus.backport175.annotation.OneWay TwoWay = org.codehaus.backport175.annotation.TwoWay
Code Block java /** * @OneWay */ public void method() { ... }
You can have more than one annotation.properties file (see the compiler section) and those are not at all required at runtime.
Rules for annotation naming consistency
...
| Code Block | ||
|---|---|---|
| ||
package demo;
/**
* @demo.Target.OneWayDefaulted
*/
public class TargetUsingDefaultValue {
public static interface OneWayDefaulted {
/**
* @org.codehaus.backport175.DefaultValue ("default message")
*/
String message();
}
}
/**
* @demo.Target.OneWayDefaulted (message="this is not the default message !")
*/
public class TargetNOTUsingDefaultValue {
...
}
| ||
| Code Block |
