From c992db275494b05627248cd741adac5d7c199603 Mon Sep 17 00:00:00 2001 From: Yuuta Liang Date: Tue, 28 Nov 2023 21:00:25 -0800 Subject: Add UML generator Signed-off-by: Yuuta Liang --- src/main/annotations/Assoc.java | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 src/main/annotations/Assoc.java (limited to 'src/main/annotations/Assoc.java') 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; +} -- cgit v1.2.3