@Documented @Retention(value=RUNTIME) @Target(value=PACKAGE) public @interface Layer
To place more than one Layer annotation on a package, use the
Layers annotation. It is a modeling error for a package to have both
a Layer and a Layers annotation.
@TypeSets({
@TypeSet("UTIL=java.util & !(java.util.{Enumeration, Hashtable, Vector})"),
@TypeSet("XML=org.jdom | UTIL | java.{io, net}")
})
@Layers({
@Layer("MODEL may refer to UTIL"),
@Layer("PERSISTENCE may refer to MODEL | XML"),
@Layer("CONTROLLER may refer to MODEL | PERSISTENCE | java.io.File")
})
package com.surelogic.smallworld;
The UTIL typeset allows the use of all the types in the
java.util package except for the Enumeration,
Hashtable, and Vector classes. The XML typeset allows
references to any type in the org.jdom package, any type in the
UTIL typeset, and any type in the java.io and
java.net packages.
Types mapped into the MODEL layer with the InLayer annotation
may refer to any type in the UTIL typeset.
Types mapped into the PERSISTENCE layer with the InLayer
annotation may refer to any type mapped into the MODEL layer and any
type in the XML typeset.
Types mapped into the CONTROLLER layer with the InLayer
annotation may refer to any type mapped into the MODEL layer, the
PERSISTENCE layer, and the java.io.File type.
@annotate tag.
/**
* @annotate TypeSet("UTIL=java.util & !(java.util.{Enumeration, Hashtable, Vector})")
* @annotate TypeSet("XML=org.jdom | UTIL | java.{io, net}")
* @annotate Layer("MODEL may refer to UTIL"),
* @annotate Layer("PERSISTENCE may refer to MODEL | XML"),
* @annotate Layer("CONTROLLER may refer to MODEL | PERSISTENCE | java.io.File")
*/
package com.surelogic.smallworld;
public abstract String value
value = name "is" ["above" name *(", name) " ;"] "may" "refer" "to" no_layer_type_set_expr
no_layer_type_set_expr = no_layer_type_set_disjunct *("|" no_layer_type_set_disjunct) ; Set union
no_layer_type_set_disjunct = no_layer_type_set_conjunct *("&" no_layer_type_set_conjunct) ; Set intersection
no_layer_type_set_conjunct = ["!"] no_layer_type_set_leaf ; Set complement
no_layer_type_set_leaf = dotted_name ; Package name, type name, or
no_layer_type set name
no_layer_type_set_leaf /= dotted_name "+" ; Package tree
no_layer_type_set_leaf /= dotted_name "." "{" name *("
," name) "}" ; Union of packages/types
no_layer_type_set_leaf /= "(" no_layer_type_set_expr ")"
The "is above" clause names those layers are immediately below this layer; that is, those layers that are allowed to be referenced by types in this layer.
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 dotted name is not allowed to refer to
layer. A named type set stands for the type set specified by the given
name, as defined by a @TypeSet annotation. The named type
set is not allowed to refer to a layer, nor is any type set that it recursively
references. 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.