aboutsummaryrefslogtreecommitdiff
path: root/src/main/annotations/Assoc.java
blob: 71ec5f5b7b228f84d0a3c47d72b0ea381f812aad (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
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;
}