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.RetentionPolicy.RUNTIME;
009
010import gov.nist.secauto.metaschema.core.model.JsonGroupAsBehavior;
011import gov.nist.secauto.metaschema.core.model.XmlGroupAsBehavior;
012
013import java.lang.annotation.Documented;
014import java.lang.annotation.ElementType;
015import java.lang.annotation.Retention;
016import java.lang.annotation.Target;
017
018import edu.umd.cs.findbugs.annotations.NonNull;
019
020@Documented
021@Retention(RUNTIME)
022@Target(ElementType.ANNOTATION_TYPE)
023public @interface GroupAs {
024  /**
025   * The name to use for an XML grouping element wrapper or a JSON/YAML grouping
026   * property.
027   *
028   * @return the name
029   */
030  @NonNull
031  String name();
032
033  /**
034   * Describes how to handle collections in JSON/YAML.
035   *
036   * @return the JSON collection strategy
037   */
038  @NonNull
039  JsonGroupAsBehavior inJson() default JsonGroupAsBehavior.SINGLETON_OR_LIST;
040
041  /**
042   * Describes how to handle collections in XML.
043   *
044   * @return the XML collection strategy
045   */
046  @NonNull
047  XmlGroupAsBehavior inXml() default XmlGroupAsBehavior.UNGROUPED;
048}