@Documented @Retention(value=RUNTIME) @Target(value=PACKAGE) public @interface TypeSet
MayReferTo and
Layer annotations. A type set is a global entity, and may be referred
to by other annotations. Its name is qualified by the name of the package
that it annotates. If the reference is within the same package, the name does
not need to be qualified.
To place more than one TypeSet annotation on a package, use the
TypeSets annotation. It is a modeling error for a package to have
both a TypeSet and a TypeSets annotation.
package-info.java file.
@TypeSet("IO = org.jdom+ | java.{io, net, util}")
package example;
Declaring a type set that consists of most, but not all of a package
@TypeSet("UTIL = java.util & !(java.util.{Enumeration, Hashtable, Vector}")
package example;
/**
* @annotate TypeSet("IO = org.jdom+ | java.{io, net, util}")
* @annotate TypeSet("UTIL = java.util & !(java.util.{Enumeration, Hashtable, Vector}")
*/
package example;
TypeSetspublic abstract String value
value = name "=" type_set_expr
type_set_expr = type_set_disjunct *("|" type_set_disjunct) ; Set union
type_set_disjunct = type_set_conjunct *("&" type_set_conjunct) ; Set intersection
type_set_conjunct = ["!"] type_set_leaf ; Set complement
type_set_leaf = dotted_name ; Package name, layer name, type name, or
type set name
type_set_leaf /= dotted_name "+" ; Package tree
type_set_leaf /= dotted_name "." "{" name *(",
" name) "}" ; Union of packages/types
type_set_leaf /= "(" type_set_expr ")"
The union, intersection, and complement operators, as well as the
parentheses have the obvious meanings, and standard precedence order. A
package name signifies all the types in that package; a named type
indicates a specific type. A named layer stands for all the types in the
layer. A named type set stands for the type set specified by the given
name, as defined by a @TypeSet annotation. The package tree suffix
"+" indicates that all the types in the package and its
subpackages are part of the set. The braces "{" "}" are
syntactic sugar used to enumerate a union of packages/types that share the
same prefix.
Copyright © 2012 Surelogic, Inc.. All Rights Reserved.