001package com.example.metaschema; 002 003import gov.nist.secauto.metaschema.core.datatype.adapter.PositiveIntegerAdapter; 004import gov.nist.secauto.metaschema.core.datatype.adapter.StringAdapter; 005import gov.nist.secauto.metaschema.core.datatype.adapter.TokenAdapter; 006import gov.nist.secauto.metaschema.core.datatype.markup.MarkupLine; 007import gov.nist.secauto.metaschema.core.datatype.markup.MarkupLineAdapter; 008import gov.nist.secauto.metaschema.core.model.IBoundObject; 009import gov.nist.secauto.metaschema.core.model.IMetaschemaData; 010import gov.nist.secauto.metaschema.core.model.JsonGroupAsBehavior; 011import gov.nist.secauto.metaschema.core.model.constraint.IConstraint; 012import gov.nist.secauto.metaschema.core.util.ObjectUtils; 013import gov.nist.secauto.metaschema.databind.model.annotations.AllowedValue; 014import gov.nist.secauto.metaschema.databind.model.annotations.AllowedValues; 015import gov.nist.secauto.metaschema.databind.model.annotations.BoundAssembly; 016import gov.nist.secauto.metaschema.databind.model.annotations.BoundField; 017import gov.nist.secauto.metaschema.databind.model.annotations.BoundFlag; 018import gov.nist.secauto.metaschema.databind.model.annotations.GroupAs; 019import gov.nist.secauto.metaschema.databind.model.annotations.MetaschemaAssembly; 020import gov.nist.secauto.metaschema.databind.model.annotations.ValueConstraints; 021import java.lang.Override; 022import java.lang.String; 023import java.math.BigInteger; 024import java.util.LinkedList; 025import java.util.List; 026import org.apache.commons.lang3.builder.ReflectionToStringBuilder; 027import org.apache.commons.lang3.builder.ToStringStyle; 028 029@MetaschemaAssembly( 030 formalName = "Inline Flag Definition", 031 name = "inline-define-flag", 032 moduleClass = MetaschemaModelModule.class 033) 034public class InlineDefineFlag implements IBoundObject { 035 private final IMetaschemaData __metaschemaData; 036 037 @BoundFlag( 038 formalName = "Inline Flag Name", 039 name = "name", 040 required = true, 041 typeAdapter = TokenAdapter.class 042 ) 043 private String _name; 044 045 @BoundFlag( 046 formalName = "Inline Flag Binary Name", 047 name = "index", 048 typeAdapter = PositiveIntegerAdapter.class 049 ) 050 private BigInteger _index; 051 052 @BoundFlag( 053 formalName = "Deprecated Version", 054 name = "deprecated", 055 typeAdapter = StringAdapter.class 056 ) 057 private String _deprecated; 058 059 @BoundFlag( 060 formalName = "Flag Value Data Type", 061 name = "as-type", 062 defaultValue = "string", 063 typeAdapter = TokenAdapter.class, 064 valueConstraints = @ValueConstraints(allowedValues = @AllowedValues(level = IConstraint.Level.ERROR, allowOthers = true, values = {@AllowedValue(value = "base64", description = "The [base64](https://pages.nist.gov/metaschema/specification/datatypes/#base64) data type."), @AllowedValue(value = "boolean", description = "The [boolean](https://pages.nist.gov/metaschema/specification/datatypes/#boolean) data type."), @AllowedValue(value = "date", description = "The [date](https://pages.nist.gov/metaschema/specification/datatypes/#date) data type."), @AllowedValue(value = "date-time", description = "The [date-time](https://pages.nist.gov/metaschema/specification/datatypes/#date-time) data type."), @AllowedValue(value = "date-time-with-timezone", description = "The [date-time-with-timezone](https://pages.nist.gov/metaschema/specification/datatypes/#date-time-with-timezone) data type."), @AllowedValue(value = "date-with-timezone", description = "The [date-with-timezone](https://pages.nist.gov/metaschema/specification/datatypes/#date-with-timezone) data type."), @AllowedValue(value = "day-time-duration", description = "The [day-time-duration](https://pages.nist.gov/metaschema/specification/datatypes/#day-time-duration) data type."), @AllowedValue(value = "decimal", description = "The [decimal](https://pages.nist.gov/metaschema/specification/datatypes/#decimal) data type."), @AllowedValue(value = "email-address", description = "The [email-address](https://pages.nist.gov/metaschema/specification/datatypes/#email-address) data type."), @AllowedValue(value = "hostname", description = "The [hostname](https://pages.nist.gov/metaschema/specification/datatypes/#hostname) data type."), @AllowedValue(value = "integer", description = "The [integer](https://pages.nist.gov/metaschema/specification/datatypes/#integer) data type."), @AllowedValue(value = "ip-v4-address", description = "The [ip-v4-address](https://pages.nist.gov/metaschema/specification/datatypes/#ip-v4-address) data type."), @AllowedValue(value = "ip-v6-address", description = "The [ip-v6-address](https://pages.nist.gov/metaschema/specification/datatypes/#ip-v6-address) data type."), @AllowedValue(value = "non-negative-integer", description = "The [non-negative-integer](https://pages.nist.gov/metaschema/specification/datatypes/#non-negative-integer) data type."), @AllowedValue(value = "positive-integer", description = "The [positive-integer](https://pages.nist.gov/metaschema/specification/datatypes/#positive-integer) data type."), @AllowedValue(value = "string", description = "The [string](https://pages.nist.gov/metaschema/specification/datatypes/#string) data type."), @AllowedValue(value = "token", description = "The [token](https://pages.nist.gov/metaschema/specification/datatypes/#token) data type."), @AllowedValue(value = "uri", description = "The [uri](https://pages.nist.gov/metaschema/specification/datatypes/#uri) data type."), @AllowedValue(value = "uri-reference", description = "The [uri-reference](https://pages.nist.gov/metaschema/specification/datatypes/#uri-reference) data type."), @AllowedValue(value = "uuid", description = "The [uuid](https://pages.nist.gov/metaschema/specification/datatypes/#uuid) data type."), @AllowedValue(value = "base64Binary", description = "An old name which is deprecated for use in favor of the 'base64' data type.", deprecatedVersion = "1.0.0"), @AllowedValue(value = "dateTime", description = "An old name which is deprecated for use in favor of the 'date-time' data type.", deprecatedVersion = "1.0.0"), @AllowedValue(value = "dateTime-with-timezone", description = "An old name which is deprecated for use in favor of the 'date-time-with-timezone' data type.", deprecatedVersion = "1.0.0"), @AllowedValue(value = "email", description = "An old name which is deprecated for use in favor of the 'email-address' data type.", deprecatedVersion = "1.0.0"), @AllowedValue(value = "nonNegativeInteger", description = "An old name which is deprecated for use in favor of the 'non-negative-integer' data type.", deprecatedVersion = "1.0.0"), @AllowedValue(value = "positiveInteger", description = "An old name which is deprecated for use in favor of the 'positive-integer' data type.", deprecatedVersion = "1.0.0")})) 065 ) 066 private String _asType; 067 068 @BoundFlag( 069 formalName = "Default Flag Value", 070 name = "default", 071 typeAdapter = StringAdapter.class 072 ) 073 private String _default; 074 075 @BoundFlag( 076 formalName = "Is Flag Required?", 077 name = "required", 078 defaultValue = "no", 079 typeAdapter = TokenAdapter.class, 080 valueConstraints = @ValueConstraints(allowedValues = @AllowedValues(level = IConstraint.Level.ERROR, values = {@AllowedValue(value = "yes", description = "The flag is required."), @AllowedValue(value = "no", description = "The flag is optional.")})) 081 ) 082 private String _required; 083 084 @BoundField( 085 formalName = "Formal Name", 086 description = "A formal name for the data construct, to be presented in documentation.", 087 useName = "formal-name" 088 ) 089 private String _formalName; 090 091 @BoundField( 092 formalName = "Description", 093 description = "A short description of the data construct's purpose, describing the constructs semantics.", 094 useName = "description", 095 typeAdapter = MarkupLineAdapter.class 096 ) 097 private MarkupLine _description; 098 099 @BoundAssembly( 100 formalName = "Property", 101 useName = "prop", 102 maxOccurs = -1, 103 groupAs = @GroupAs(name = "props", inJson = JsonGroupAsBehavior.LIST) 104 ) 105 private List<Property> _props; 106 107 @BoundAssembly( 108 useName = "constraint" 109 ) 110 private FlagConstraints _constraint; 111 112 @BoundField( 113 formalName = "Remarks", 114 description = "Any explanatory or helpful information to be provided about the remarks parent.", 115 useName = "remarks" 116 ) 117 private Remarks _remarks; 118 119 @BoundAssembly( 120 formalName = "Example", 121 useName = "example", 122 maxOccurs = -1, 123 groupAs = @GroupAs(name = "examples", inJson = JsonGroupAsBehavior.LIST) 124 ) 125 private List<Example> _examples; 126 127 public InlineDefineFlag() { 128 this(null); 129 } 130 131 public InlineDefineFlag(IMetaschemaData data) { 132 this.__metaschemaData = data; 133 } 134 135 @Override 136 public IMetaschemaData getMetaschemaData() { 137 return __metaschemaData; 138 } 139 140 public String getName() { 141 return _name; 142 } 143 144 public void setName(String value) { 145 _name = value; 146 } 147 148 public BigInteger getIndex() { 149 return _index; 150 } 151 152 public void setIndex(BigInteger value) { 153 _index = value; 154 } 155 156 public String getDeprecated() { 157 return _deprecated; 158 } 159 160 public void setDeprecated(String value) { 161 _deprecated = value; 162 } 163 164 public String getAsType() { 165 return _asType; 166 } 167 168 public void setAsType(String value) { 169 _asType = value; 170 } 171 172 public String getDefault() { 173 return _default; 174 } 175 176 public void setDefault(String value) { 177 _default = value; 178 } 179 180 public String getRequired() { 181 return _required; 182 } 183 184 public void setRequired(String value) { 185 _required = value; 186 } 187 188 public String getFormalName() { 189 return _formalName; 190 } 191 192 public void setFormalName(String value) { 193 _formalName = value; 194 } 195 196 public MarkupLine getDescription() { 197 return _description; 198 } 199 200 public void setDescription(MarkupLine value) { 201 _description = value; 202 } 203 204 public List<Property> getProps() { 205 return _props; 206 } 207 208 public void setProps(List<Property> value) { 209 _props = value; 210 } 211 212 /** 213 * Add a new {@link Property} item to the underlying collection. 214 * @param item the item to add 215 * @return {@code true} 216 */ 217 public boolean addProp(Property item) { 218 Property value = ObjectUtils.requireNonNull(item,"item cannot be null"); 219 if (_props == null) { 220 _props = new LinkedList<>(); 221 } 222 return _props.add(value); 223 } 224 225 /** 226 * Remove the first matching {@link Property} item from the underlying collection. 227 * @param item the item to remove 228 * @return {@code true} if the item was removed or {@code false} otherwise 229 */ 230 public boolean removeProp(Property item) { 231 Property value = ObjectUtils.requireNonNull(item,"item cannot be null"); 232 return _props != null && _props.remove(value); 233 } 234 235 public FlagConstraints getConstraint() { 236 return _constraint; 237 } 238 239 public void setConstraint(FlagConstraints value) { 240 _constraint = value; 241 } 242 243 public Remarks getRemarks() { 244 return _remarks; 245 } 246 247 public void setRemarks(Remarks value) { 248 _remarks = value; 249 } 250 251 public List<Example> getExamples() { 252 return _examples; 253 } 254 255 public void setExamples(List<Example> value) { 256 _examples = value; 257 } 258 259 /** 260 * Add a new {@link Example} item to the underlying collection. 261 * @param item the item to add 262 * @return {@code true} 263 */ 264 public boolean addExample(Example item) { 265 Example value = ObjectUtils.requireNonNull(item,"item cannot be null"); 266 if (_examples == null) { 267 _examples = new LinkedList<>(); 268 } 269 return _examples.add(value); 270 } 271 272 /** 273 * Remove the first matching {@link Example} item from the underlying collection. 274 * @param item the item to remove 275 * @return {@code true} if the item was removed or {@code false} otherwise 276 */ 277 public boolean removeExample(Example item) { 278 Example value = ObjectUtils.requireNonNull(item,"item cannot be null"); 279 return _examples != null && _examples.remove(value); 280 } 281 282 @Override 283 public String toString() { 284 return new ReflectionToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE).toString(); 285 } 286}