001/*
002 * Portions of this software was developed by employees of the National Institute
003 * of Standards and Technology (NIST), an agency of the Federal Government and is
004 * being made available as a public service. Pursuant to title 17 United States
005 * Code Section 105, works of NIST employees are not subject to copyright
006 * protection in the United States. This software may be subject to foreign
007 * copyright. Permission in the United States and in foreign countries, to the
008 * extent that NIST may hold copyright, to use, copy, modify, create derivative
009 * works, and distribute this software and its documentation without fee is hereby
010 * granted on a non-exclusive basis, provided that this notice and disclaimer
011 * of warranty appears in all copies.
012 *
013 * THE SOFTWARE IS PROVIDED 'AS IS' WITHOUT ANY WARRANTY OF ANY KIND, EITHER
014 * EXPRESSED, IMPLIED, OR STATUTORY, INCLUDING, BUT NOT LIMITED TO, ANY WARRANTY
015 * THAT THE SOFTWARE WILL CONFORM TO SPECIFICATIONS, ANY IMPLIED WARRANTIES OF
016 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, AND FREEDOM FROM
017 * INFRINGEMENT, AND ANY WARRANTY THAT THE DOCUMENTATION WILL CONFORM TO THE
018 * SOFTWARE, OR ANY WARRANTY THAT THE SOFTWARE WILL BE ERROR FREE.  IN NO EVENT
019 * SHALL NIST BE LIABLE FOR ANY DAMAGES, INCLUDING, BUT NOT LIMITED TO, DIRECT,
020 * INDIRECT, SPECIAL OR CONSEQUENTIAL DAMAGES, ARISING OUT OF, RESULTING FROM,
021 * OR IN ANY WAY CONNECTED WITH THIS SOFTWARE, WHETHER OR NOT BASED UPON WARRANTY,
022 * CONTRACT, TORT, OR OTHERWISE, WHETHER OR NOT INJURY WAS SUSTAINED BY PERSONS OR
023 * PROPERTY OR OTHERWISE, AND WHETHER OR NOT LOSS WAS SUSTAINED FROM, OR AROSE OUT
024 * OF THE RESULTS OF, OR USE OF, THE SOFTWARE OR SERVICES PROVIDED HEREUNDER.
025 */
026
027package gov.nist.secauto.metaschema.databind.model.annotations;
028
029import static java.lang.annotation.ElementType.FIELD;
030import static java.lang.annotation.RetentionPolicy.RUNTIME;
031
032import gov.nist.secauto.metaschema.core.model.MetaschemaModelConstants;
033
034import java.lang.annotation.Documented;
035import java.lang.annotation.Retention;
036import java.lang.annotation.Target;
037
038import edu.umd.cs.findbugs.annotations.NonNull;
039
040/**
041 * Identifies that the annotation target is a bound property that references a
042 * Module assembly.
043 * <p>
044 * For XML serialization, the {@link #useName()} identifies the name of the
045 * element to use and the {@link #namespace()} identifies the namespace of this
046 * element.
047 * <p>
048 * For JSON and YAML serializations, the {@link #useName()} identifies the
049 * property/item name to use.
050 */
051@Documented
052@Retention(RUNTIME)
053@Target({ FIELD })
054public @interface BoundAssembly {
055  /**
056   * Get the documentary formal name of the assembly.
057   * <p>
058   * If the value is "##none", then the description will be considered
059   * {@code null}.
060   *
061   * @return a markdown string or {@code "##none"} if no formal name is provided
062   */
063  @NonNull
064  String formalName() default Constants.NO_STRING_VALUE;
065
066  /**
067   * Get the documentary description of the assembly.
068   * <p>
069   * If the value is "##none", then the description will be considered
070   * {@code null}.
071   *
072   * @return a markdown string or {@code "##none"} if no description is provided
073   */
074  @NonNull
075  String description() default Constants.NO_STRING_VALUE;
076
077  /**
078   * The model name to use for singleton values. This name will be used for
079   * associated XML elements.
080   * <p>
081   * If the value is "##none", then element name is derived from the JavaBean
082   * property name.
083   *
084   * @return the name or {@code "##none"} if no use name is provided
085   */
086  @NonNull
087  String useName() default Constants.NO_STRING_VALUE;
088
089  /**
090   * The namespace to use for associated XML elements.
091   * <p>
092   * If the value is "##default", then element name is derived from the namespace
093   * provided in the package-info.
094   *
095   * @return the namespace
096   */
097  @NonNull
098  String namespace() default Constants.DEFAULT_STRING_VALUE;
099
100  /**
101   * A non-negative number that indicates the minimum occurrence of the model
102   * instance.
103   *
104   * @return a non-negative number
105   */
106  int minOccurs() default MetaschemaModelConstants.DEFAULT_GROUP_AS_MIN_OCCURS;
107
108  /**
109   * A number that indicates the maximum occurrence of the model instance.
110   *
111   * @return a positive number or {@code -1} to indicate "unbounded"
112   */
113  int maxOccurs() default MetaschemaModelConstants.DEFAULT_GROUP_AS_MAX_OCCURS;
114
115  /**
116   * Get any remarks for this field.
117   *
118   * @return a markdown string or {@code "##none"} if no remarks are provided
119   */
120  @NonNull
121  String remarks() default Constants.NO_STRING_VALUE;
122}