001/*
002 * SPDX-FileCopyrightText: none
003 * SPDX-License-Identifier: CC0-1.0
004 */
005
006package dev.metaschema.databind.model.annotations;
007
008import static java.lang.annotation.RetentionPolicy.RUNTIME;
009
010import java.lang.annotation.Documented;
011import java.lang.annotation.ElementType;
012import java.lang.annotation.Retention;
013import java.lang.annotation.Target;
014
015import edu.umd.cs.findbugs.annotations.NonNull;
016
017/**
018 * Defines value-level constraints for field and flag definitions.
019 */
020@Documented
021@Retention(RUNTIME)
022@Target(ElementType.ANNOTATION_TYPE)
023public @interface ValueConstraints {
024  /**
025   * Get the let statements for the type of field this annotation is applied to.
026   *
027   * @return the let statements or an empty array if no let statements are defined
028   */
029  @NonNull
030  Let[] lets() default {};
031
032  /**
033   * Get the allowed value constraints for the type or field this annotation is
034   * applied to.
035   *
036   * @return the allowed values or an empty array if no allowed values constraints
037   *         are defined
038   */
039  @NonNull
040  AllowedValues[] allowedValues() default {};
041
042  /**
043   * Get the matches constraints for the type or field this annotation is applied
044   * to.
045   *
046   * @return the allowed values or an empty array if no allowed values constraints
047   *         are defined
048   */
049  @NonNull
050  Matches[] matches() default {};
051
052  /**
053   * Get the index-has-key constraints for the type or field this annotation is
054   * applied to.
055   *
056   * @return the allowed values or an empty array if no allowed values constraints
057   *         are defined
058   */
059  @NonNull
060  IndexHasKey[] indexHasKey() default {};
061
062  /**
063   * Get the expect constraints for the type or field this annotation is applied
064   * to.
065   *
066   * @return the expected constraints or an empty array if no expected constraints
067   *         are defined
068   */
069  @NonNull
070  Expect[] expect() default {};
071
072  /**
073   * Get the report constraints for the type or field this annotation is applied
074   * to.
075   * <p>
076   * Report constraints generate findings when their test expression evaluates to
077   * {@code true}, which is the opposite of expect constraints.
078   *
079   * @return the report constraints or an empty array if no report constraints are
080   *         defined
081   */
082  @NonNull
083  Report[] report() default {};
084}