001/*
002 * SPDX-FileCopyrightText: none
003 * SPDX-License-Identifier: CC0-1.0
004 */
005
006package gov.nist.secauto.metaschema.databind.model.annotations;
007
008import static java.lang.annotation.ElementType.ANNOTATION_TYPE;
009import static java.lang.annotation.ElementType.FIELD;
010import static java.lang.annotation.ElementType.METHOD;
011import static java.lang.annotation.RetentionPolicy.RUNTIME;
012
013import gov.nist.secauto.metaschema.core.model.IBoundObject;
014
015import java.lang.annotation.Documented;
016import java.lang.annotation.Retention;
017import java.lang.annotation.Target;
018
019import edu.umd.cs.findbugs.annotations.NonNull;
020
021/**
022 * Identifies that the annotation target is a bound property that references a
023 * Module assembly.
024 * <p>
025 * For XML serialization, the {@link #useName()} identifies the name of the
026 * element to use for this element.
027 * <p>
028 * For JSON and YAML serializations, the {@link #useName()} identifies the
029 * property/item name to use.
030 */
031@Documented
032@Retention(RUNTIME)
033@Target({ FIELD, METHOD, ANNOTATION_TYPE })
034public @interface BoundGroupedAssembly {
035  /**
036   * Get the documentary formal name of the assembly.
037   * <p>
038   * If the value is "##none", then the description will be considered
039   * {@code null}.
040   *
041   * @return a markdown string or {@code "##none"} if no formal name is provided
042   */
043  @NonNull
044  String formalName() default ModelUtil.NO_STRING_VALUE;
045
046  /**
047   * Get the documentary description of the assembly.
048   * <p>
049   * If the value is "##none", then the description will be considered
050   * {@code null}.
051   *
052   * @return a markdown string or {@code "##none"} if no description is provided
053   */
054  @NonNull
055  String description() default ModelUtil.NO_STRING_VALUE;
056
057  /**
058   * The model name to use for singleton values. This name will be used for
059   * associated XML elements.
060   * <p>
061   * If the value is "##none", then element name is derived from the JavaBean
062   * property name.
063   *
064   * @return the name or {@code "##none"} if no use name is provided
065   */
066  @NonNull
067  String useName() default ModelUtil.NO_STRING_VALUE;
068
069  /**
070   * The binary use name of the assembly.
071   * <p>
072   * The value {@link Integer#MIN_VALUE} indicates that there is no use name.
073   *
074   * @return the index value
075   */
076  int useIndex() default Integer.MIN_VALUE;
077
078  /**
079   * An optional set of associated properties.
080   *
081   * @return the properties or an empty array with no properties
082   */
083  Property[] properties() default {};
084
085  /**
086   * Get any remarks for this field.
087   *
088   * @return a markdown string or {@code "##none"} if no remarks are provided
089   */
090  @NonNull
091  String remarks() default ModelUtil.NO_STRING_VALUE;
092
093  /**
094   * Get any remarks for this field.
095   *
096   * @return the discriminator string or {@code "##none"} if no discriminator is
097   *         provided
098   */
099  @NonNull
100  String discriminatorValue() default ModelUtil.NO_STRING_VALUE;
101
102  /**
103   * The bound class associated with this assembly.
104   * <p>
105   * This is optional when used on a field or method, and required when used with
106   * an annotation type value, i.e. {@link BoundChoiceGroup}.
107   *
108   * @return the bound class
109   */
110  @NonNull
111  Class<? extends IBoundObject> binding();
112}