@Target(value=PACKAGE) @Retention(value=RUNTIME) @Documented public @interface BoundedContext
Java does not have the notion of package nesting. Packages in Java are separated namespaces which seem to have a hierarchical structure for convenience.
This annotation assumes that nesting formed by a programmer when naming packages is a hierarchy. Terms mentioned below assume that package “inheritance” or “hierarchy” is a convention supported by this framework and is not a standard feature of Java.
Packages which names start with the name of the annotated package “inherit” the annotation. This means that these packages belong to the same Bounded Context unless they are annotated with another Bounded Context name.
A possible usage scenario would be to have an aggregate root class placed in a “parent” package, and aggregate parts being under “sub-packages”.
Packages that do not have a common “parent” but annotated with the same name of a Bounded Context belong to the same Bounded Context.
|Modifier and Type||Required Element and Description|
The name of the Bounded Context to which the package belongs.