Overview of annotations
Gosu annotations are a syntax to provide metadata about a Gosu class, constructor, method, class variable, or property. An annotation can control the behavior of the item or the documentation for the item.
This code demonstrates adding a @Throws annotation to a method
to indicate what exceptions it throws.
class MyClass{
@Throws(java.text.ParseException, "If text is invalid format, throws ParseException")
public function myMethod() {
...
}
}
You can define custom annotations, and optionally have your annotations take arguments. If there are no arguments, you can omit the parentheses.
You can get annotations from types at run time.
Gosu supports named arguments syntax for annotations:
@MyAnnotation(a = "myname", b = true)See also
