Skip to content
JonathanO edited this page Feb 10, 2013 · 6 revisions

The Annotation type system

Simple types

These are very boring:

  • string These appear in annotations as quoted strings
  • boolean (also bool) These appear in annotations as unquoted true/false values
  • integer (also int) Unquoted numeric value with no decimal point or E notation
  • float Unquoted numeric value with a decimal point or E notation

Arrays

The type name for an array uses [] syntax, e.g. an array of strings would be string[]. The array index is assumed to be an int, unless otherwise specified in the [] e.g. string[string] for a map of strings to strings. Specifying multi-dimensional arrays is possible by adding additional sets of []. If you use empty [] it is assumed that you do not care about preserving array indexes, only ordering. If you have numeric keys and those keys are important then you must use [int]

In an annotation an array will appear with comma separated values inside braces e.g. `{"foo", "bar", "baz"}. At present specifying values for the indices is NOT possible, all arrays are assumed to be numerically indexed.

Mixed types within an array are not possible.

Objects

Any type name that isn't recognised as an array is assumed to be a class name.

The only objects permitted as values inside annotations are other annotations, see e.g. the arguments to @AnnotationCreator where an array of @Parameter appears

Clone this wiki locally