1   /*
2    * SPDX-FileCopyrightText: none
3    * SPDX-License-Identifier: CC0-1.0
4    */
5   
6   package dev.metaschema.databind.model.annotations;
7   
8   import static java.lang.annotation.RetentionPolicy.RUNTIME;
9   
10  import java.lang.annotation.Documented;
11  import java.lang.annotation.ElementType;
12  import java.lang.annotation.Retention;
13  import java.lang.annotation.Target;
14  
15  import edu.umd.cs.findbugs.annotations.NonNull;
16  
17  /**
18   * Defines value-level constraints for field and flag definitions.
19   */
20  @Documented
21  @Retention(RUNTIME)
22  @Target(ElementType.ANNOTATION_TYPE)
23  public @interface ValueConstraints {
24    /**
25     * Get the let statements for the type of field this annotation is applied to.
26     *
27     * @return the let statements or an empty array if no let statements are defined
28     */
29    @NonNull
30    Let[] lets() default {};
31  
32    /**
33     * Get the allowed value constraints for the type or field this annotation is
34     * applied to.
35     *
36     * @return the allowed values or an empty array if no allowed values constraints
37     *         are defined
38     */
39    @NonNull
40    AllowedValues[] allowedValues() default {};
41  
42    /**
43     * Get the matches constraints for the type or field this annotation is applied
44     * to.
45     *
46     * @return the allowed values or an empty array if no allowed values constraints
47     *         are defined
48     */
49    @NonNull
50    Matches[] matches() default {};
51  
52    /**
53     * Get the index-has-key constraints for the type or field this annotation is
54     * applied to.
55     *
56     * @return the allowed values or an empty array if no allowed values constraints
57     *         are defined
58     */
59    @NonNull
60    IndexHasKey[] indexHasKey() default {};
61  
62    /**
63     * Get the expect constraints for the type or field this annotation is applied
64     * to.
65     *
66     * @return the expected constraints or an empty array if no expected constraints
67     *         are defined
68     */
69    @NonNull
70    Expect[] expect() default {};
71  
72    /**
73     * Get the report constraints for the type or field this annotation is applied
74     * to.
75     * <p>
76     * Report constraints generate findings when their test expression evaluates to
77     * {@code true}, which is the opposite of expect constraints.
78     *
79     * @return the report constraints or an empty array if no report constraints are
80     *         defined
81     */
82    @NonNull
83    Report[] report() default {};
84  }