aboutsummaryrefslogtreecommitdiff
path: root/src/main/annotations/Assoc.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/annotations/Assoc.java')
-rw-r--r--src/main/annotations/Assoc.java37
1 files changed, 37 insertions, 0 deletions
diff --git a/src/main/annotations/Assoc.java b/src/main/annotations/Assoc.java
new file mode 100644
index 0000000..71ec5f5
--- /dev/null
+++ b/src/main/annotations/Assoc.java
@@ -0,0 +1,37 @@
+package annotations;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+/**
+ * Denotes the association relationship of a field.
+ * Used only for the UML static analyzer.
+ * Fields without that annotation will be treated as:
+ * 1. For non-list and non-array field: Single association relationship (--->)
+ * 2. For list and array: Multiple relationship (---> 0..*)
+ * Use this annotation to specify bonds and part-of relationships.
+ */
+@Retention(RetentionPolicy.CLASS)
+@Target(ElementType.FIELD)
+public @interface Assoc {
+ /**
+ * EFFECTS: Return the lower bond of the list or variable. Return 0 for nullable variables.
+ * Defaults to 1 (single variable, means nonnull) or 0 (list, means empty-able).
+ */
+ int lowerBond() default 1;
+
+ /**
+ * EFFECTS: Return the upper bond of the list.
+ * Defaults to 1 (single variable) or -1 (list, means *)
+ * REQUIRES: For a single variable, it must return 1.
+ */
+ int upperBond() default -1;
+
+ /**
+ * EFFECTS: Returns whether the field is in a part-of relationship.
+ * Defaults to false.
+ */
+ boolean partOf() default false;
+}