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.FIELD; 009import static java.lang.annotation.ElementType.METHOD; 010import static java.lang.annotation.RetentionPolicy.RUNTIME; 011 012import gov.nist.secauto.metaschema.core.datatype.IDataTypeAdapter; 013 014import java.lang.annotation.Documented; 015import java.lang.annotation.Retention; 016import java.lang.annotation.Target; 017 018import edu.umd.cs.findbugs.annotations.NonNull; 019 020/** 021 * Identifies that the annotation target is a bound property that represents a 022 * Module flag. 023 */ 024@Documented 025@Retention(RUNTIME) 026@Target({ FIELD, METHOD }) 027public @interface BoundFlag { 028 /** 029 * Get the documentary formal name of the flag. 030 * <p> 031 * If the value is "##none", then the description will be considered 032 * {@code null}. 033 * 034 * @return a markdown string or {@code "##none"} if no formal name is provided 035 */ 036 @NonNull 037 String formalName() default ModelUtil.NO_STRING_VALUE; 038 039 /** 040 * Get the documentary description of the flag. 041 * <p> 042 * If the value is "##none", then the description will be considered 043 * {@code null}. 044 * 045 * @return a markdown string or {@code "##none"} if no description is provided 046 */ 047 @NonNull 048 String description() default ModelUtil.NO_STRING_VALUE; 049 050 /** 051 * The model name to use for singleton values. This name will be used for 052 * associated XML attributes and JSON properties. 053 * <p> 054 * If the value is "##none", then element name is derived from the JavaBean 055 * property name. 056 * 057 * @return the name 058 */ 059 @NonNull 060 String name() default ModelUtil.NO_STRING_VALUE; 061 062 /** 063 * The binary use name of the flag. 064 * <p> 065 * The value {@link Integer#MIN_VALUE} indicates that there is no use name. 066 * 067 * @return the index value 068 */ 069 int useIndex() default Integer.MIN_VALUE; 070 071 /** 072 * The default value of the flag represented as a string. 073 * <p> 074 * The value {@link ModelUtil#NULL_VALUE} is used to indicate if no default 075 * value is provided. 076 * 077 * @return the default value 078 */ 079 @NonNull 080 String defaultValue() default ModelUtil.NULL_VALUE; 081 082 /** 083 * Specifies if the XML Schema attribute is optional or required. If true, then 084 * the JavaBean property is mapped to a XML Schema attribute that is required. 085 * Otherwise it is mapped to a XML Schema attribute that is optional. 086 * 087 * @return {@code true} if the flag must occur, or {@code false} otherwise 088 */ 089 boolean required() default false; 090 091 /** 092 * The Module data type adapter for the field's value. 093 * 094 * @return the data type adapter 095 */ 096 @NonNull 097 Class<? extends IDataTypeAdapter<?>> typeAdapter() default NullJavaTypeAdapter.class; 098 099 /** 100 * An optional set of associated properties. 101 * 102 * @return the properties or an empty array with no properties 103 */ 104 Property[] properties() default {}; 105 106 /** 107 * Get any remarks for this flag. 108 * 109 * @return a markdown string or {@code "##none"} if no remarks are provided 110 */ 111 @NonNull 112 String remarks() default ModelUtil.NO_STRING_VALUE; 113 114 /** 115 * Get the value constraints defined for this Metaschema flag inline definition. 116 * 117 * @return the value constraints 118 */ 119 ValueConstraints valueConstraints() default @ValueConstraints; 120}