1   /*
2    * SPDX-FileCopyrightText: none
3    * SPDX-License-Identifier: CC0-1.0
4    */
5   
6   package gov.nist.secauto.metaschema.databind.model.annotations;
7   
8   import static java.lang.annotation.RetentionPolicy.RUNTIME;
9   
10  import gov.nist.secauto.metaschema.core.model.JsonGroupAsBehavior;
11  import gov.nist.secauto.metaschema.core.model.XmlGroupAsBehavior;
12  
13  import java.lang.annotation.Documented;
14  import java.lang.annotation.ElementType;
15  import java.lang.annotation.Retention;
16  import java.lang.annotation.Target;
17  
18  import edu.umd.cs.findbugs.annotations.NonNull;
19  
20  @Documented
21  @Retention(RUNTIME)
22  @Target(ElementType.ANNOTATION_TYPE)
23  public @interface GroupAs {
24    /**
25     * The name to use for an XML grouping element wrapper or a JSON/YAML grouping
26     * property.
27     *
28     * @return the name
29     */
30    @NonNull
31    String name();
32  
33    /**
34     * Describes how to handle collections in JSON/YAML.
35     *
36     * @return the JSON collection strategy
37     */
38    @NonNull
39    JsonGroupAsBehavior inJson() default JsonGroupAsBehavior.SINGLETON_OR_LIST;
40  
41    /**
42     * Describes how to handle collections in XML.
43     *
44     * @return the XML collection strategy
45     */
46    @NonNull
47    XmlGroupAsBehavior inXml() default XmlGroupAsBehavior.UNGROUPED;
48  }