001package com.example.metaschema; 002 003import gov.nist.secauto.metaschema.core.datatype.adapter.NonNegativeIntegerAdapter; 004import gov.nist.secauto.metaschema.core.datatype.adapter.PositiveIntegerAdapter; 005import gov.nist.secauto.metaschema.core.datatype.adapter.StringAdapter; 006import gov.nist.secauto.metaschema.core.datatype.adapter.TokenAdapter; 007import gov.nist.secauto.metaschema.core.datatype.adapter.UriAdapter; 008import gov.nist.secauto.metaschema.core.datatype.adapter.UriReferenceAdapter; 009import gov.nist.secauto.metaschema.core.datatype.markup.MarkupLine; 010import gov.nist.secauto.metaschema.core.datatype.markup.MarkupLineAdapter; 011import gov.nist.secauto.metaschema.core.model.IBoundObject; 012import gov.nist.secauto.metaschema.core.model.IMetaschemaData; 013import gov.nist.secauto.metaschema.core.model.JsonGroupAsBehavior; 014import gov.nist.secauto.metaschema.core.model.constraint.IConstraint; 015import gov.nist.secauto.metaschema.core.util.ObjectUtils; 016import gov.nist.secauto.metaschema.databind.model.annotations.AllowedValue; 017import gov.nist.secauto.metaschema.databind.model.annotations.AllowedValues; 018import gov.nist.secauto.metaschema.databind.model.annotations.BoundAssembly; 019import gov.nist.secauto.metaschema.databind.model.annotations.BoundChoiceGroup; 020import gov.nist.secauto.metaschema.databind.model.annotations.BoundField; 021import gov.nist.secauto.metaschema.databind.model.annotations.BoundFieldValue; 022import gov.nist.secauto.metaschema.databind.model.annotations.BoundFlag; 023import gov.nist.secauto.metaschema.databind.model.annotations.BoundGroupedAssembly; 024import gov.nist.secauto.metaschema.databind.model.annotations.Expect; 025import gov.nist.secauto.metaschema.databind.model.annotations.GroupAs; 026import gov.nist.secauto.metaschema.databind.model.annotations.Index; 027import gov.nist.secauto.metaschema.databind.model.annotations.IsUnique; 028import gov.nist.secauto.metaschema.databind.model.annotations.KeyField; 029import gov.nist.secauto.metaschema.databind.model.annotations.Let; 030import gov.nist.secauto.metaschema.databind.model.annotations.MetaschemaAssembly; 031import gov.nist.secauto.metaschema.databind.model.annotations.MetaschemaField; 032import gov.nist.secauto.metaschema.databind.model.annotations.ValueConstraints; 033import java.lang.Object; 034import java.lang.Override; 035import java.lang.String; 036import java.math.BigInteger; 037import java.net.URI; 038import java.util.LinkedList; 039import java.util.List; 040import org.apache.commons.lang3.builder.ReflectionToStringBuilder; 041import org.apache.commons.lang3.builder.ToStringStyle; 042 043/** 044 * A declaration of the Metaschema module. 045 */ 046@MetaschemaAssembly( 047 formalName = "Metaschema Module", 048 description = "A declaration of the Metaschema module.", 049 name = "METASCHEMA", 050 moduleClass = MetaschemaModelModule.class, 051 rootName = "METASCHEMA", 052 valueConstraints = @ValueConstraints(lets = {@Let(name = "all-imports", target = "recurse-depth('for $import in ./import return doc(resolve-uri($import/@href))/METASCHEMA')"), @Let(name = "deprecated-type-map", target = "map { 'base64Binary':'base64','dateTime':'date-time','dateTime-with-timezone':'date-time-with-timezone','email':'email-address','nonNegativeInteger':'non-negative-integer','positiveInteger':'positive-integer' }")}, expect = {@Expect(id = "module-top-level-version-required", formalName = "Require Schema Version for Top-Level Modules", description = "A top-level module, a module that is not marked as @abstract='yes', must have a schema version specified.", level = IConstraint.Level.WARNING, target = ".[not(@abstract) or @abstract='no']", test = "schema-version", message = "Unless marked as @abstract='yes', a Metaschema module (or an imported module) should have a schema version."), @Expect(id = "module-top-level-root-required", formalName = "Require Root Assembly for Top-Level Modules", description = "A top-level module, a module that is not marked as @abstract='yes', must have at least one assembly with a root-name.", level = IConstraint.Level.WARNING, target = ".[not(@abstract) or @abstract='no']", test = "exists($all-imports/define-assembly/root-name)", message = "Unless marked as @abstract='yes', a Metaschema module (or an imported module) should have at least one assembly with a root-name."), @Expect(id = "module-import-href-available", formalName = "Import is Resolvable", description = "Ensure each import has a resolvable @href.", level = IConstraint.Level.ERROR, target = "import", test = "doc-available(resolve-uri(@href))", message = "Unable to access a Metaschema module at '{{ resolve-uri(@href) }}'."), @Expect(id = "module-import-href-is-module", formalName = "Import is a Metaschema module", description = "Ensure each import is a Metaschema module.", level = IConstraint.Level.ERROR, target = "import", test = "doc(resolve-uri(@href))/METASCHEMA ! exists(.)", message = "Unable the resource at '{{ resolve-uri(@href) }}' is not a Metaschema module."), @Expect(id = "metaschema-deprecated-types", formalName = "Avoid Deprecated Data Type Use", description = "Ensure that the data type specified is not one of the legacy Metaschema data types which have been deprecated (i.e. base64Binary, dateTime, dateTime-with-timezone, email, nonNegativeInteger, positiveInteger).", level = IConstraint.Level.WARNING, target = ".//matches/@datatype|.//(define-field|define-flag)/@as-type", test = "not(.=('base64Binary','dateTime','dateTime-with-timezone','email','nonNegativeInteger','positiveInteger'))", message = "Use of the type '{ . }' is deprecated. Use '{ $deprecated-type-map(.)}' instead.")}), 053 modelConstraints = @gov.nist.secauto.metaschema.databind.model.annotations.AssemblyConstraints(index = @Index(id = "module-short-name-unique", formalName = "Index Module Short Names", description = "Ensures that the current and all imported modules have a unique short name.", level = IConstraint.Level.ERROR, target = "(.|$all-imports)", name = "metaschema-metadata-short-name-index", keyFields = @KeyField(target = "@short-name")), unique = {@IsUnique(id = "module-namespace-unique-entry", formalName = "Require Unique Namespace Entries", description = "Ensures that all declared namespace entries are unique.", level = IConstraint.Level.ERROR, target = "namespace-binding", keyFields = {@KeyField(target = "@prefix"), @KeyField(target = "@uri")}), @IsUnique(id = "module-namespace-unique-prefix", formalName = "Require Unique Namespace Entry Prefixes", description = "Ensures that all declared namespace entries have a unique prefix.", level = IConstraint.Level.ERROR, target = "namespace-binding", keyFields = @KeyField(target = "@prefix"))}) 054) 055public class METASCHEMA implements IBoundObject { 056 private final IMetaschemaData __metaschemaData; 057 058 /** 059 * "Determines if the Metaschema module is abstract (‘yes’) or not (‘no’)." 060 */ 061 @BoundFlag( 062 formalName = "Is Abstract?", 063 description = "Determines if the Metaschema module is abstract ('yes') or not ('no').", 064 name = "abstract", 065 defaultValue = "no", 066 typeAdapter = TokenAdapter.class, 067 valueConstraints = @ValueConstraints(allowedValues = @AllowedValues(level = IConstraint.Level.ERROR, values = {@AllowedValue(value = "yes", description = "The module is abstract."), @AllowedValue(value = "no", description = "The module is not abstract.")})) 068 ) 069 private String _abstract; 070 071 @BoundField( 072 formalName = "Module Name", 073 description = "The name of the information model represented by this Metaschema definition.", 074 useName = "schema-name", 075 minOccurs = 1, 076 typeAdapter = MarkupLineAdapter.class 077 ) 078 private MarkupLine _schemaName; 079 080 @BoundField( 081 description = "A version string used to distinguish between multiple revisions of the same Metaschema module.", 082 useName = "schema-version", 083 minOccurs = 1 084 ) 085 private String _schemaVersion; 086 087 @BoundField( 088 formalName = "Module Short Name", 089 description = "A short (code) name to be used for the Metaschema module. This name may be used as a constituent of names assigned to derived artifacts, such as schemas and conversion utilities.", 090 useName = "short-name", 091 minOccurs = 1, 092 typeAdapter = TokenAdapter.class 093 ) 094 private String _shortName; 095 096 @BoundField( 097 formalName = "Module Collection Namespace", 098 description = "The namespace for the collection of Metaschema module this Metaschema module belongs to. This value is also used as the XML namespace governing the names of elements in XML documents. By using this namespace, documents and document fragments used in mixed-format environments may be distinguished from neighbor XML formats using another namespaces. This value is not reflected in Metaschema JSON.", 099 useName = "namespace", 100 minOccurs = 1, 101 typeAdapter = UriAdapter.class 102 ) 103 private URI _namespace; 104 105 @BoundField( 106 formalName = "JSON Base URI", 107 description = "The JSON Base URI is the nominal base URI assigned to a JSON Schema instance expressing the model defined by this Metaschema module.", 108 useName = "json-base-uri", 109 minOccurs = 1, 110 typeAdapter = UriAdapter.class 111 ) 112 private URI _jsonBaseUri; 113 114 @BoundField( 115 formalName = "Remarks", 116 description = "Any explanatory or helpful information to be provided about the remarks parent.", 117 useName = "remarks" 118 ) 119 private Remarks _remarks; 120 121 @BoundAssembly( 122 formalName = "Module Import", 123 description = "Imports a set of Metaschema modules contained in another resource. Imports support the reuse of common information structures.", 124 useName = "import", 125 maxOccurs = -1, 126 groupAs = @GroupAs(name = "imports", inJson = JsonGroupAsBehavior.LIST) 127 ) 128 private List<Import> _imports; 129 130 @BoundAssembly( 131 formalName = "Metapath Namespace Declaration", 132 description = "Assigns a Metapath namespace to a prefix for use in a Metapath expression in a lexical qualified name.", 133 useName = "namespace-binding", 134 maxOccurs = -1, 135 groupAs = @GroupAs(name = "namespace-bindings") 136 ) 137 private List<MetapathNamespace> _namespaceBindings; 138 139 @BoundChoiceGroup( 140 maxOccurs = -1, 141 assemblies = { 142 @BoundGroupedAssembly(formalName = "Global Assembly Definition", description = "In XML, an element with structured element content. In JSON, an object with properties. Defined globally, an assembly can be assigned to appear in the `model` of any assembly (another assembly type, or itself), by `assembly` reference.", useName = "define-assembly", binding = DefineAssembly.class), 143 @BoundGroupedAssembly(formalName = "Global Field Definition", useName = "define-field", binding = DefineField.class), 144 @BoundGroupedAssembly(formalName = "Global Flag Definition", useName = "define-flag", binding = DefineFlag.class) 145 }, 146 groupAs = @GroupAs(name = "definitions", inJson = JsonGroupAsBehavior.LIST) 147 ) 148 private List<Object> _definitions; 149 150 public METASCHEMA() { 151 this(null); 152 } 153 154 public METASCHEMA(IMetaschemaData data) { 155 this.__metaschemaData = data; 156 } 157 158 @Override 159 public IMetaschemaData getMetaschemaData() { 160 return __metaschemaData; 161 } 162 163 public String getAbstract() { 164 return _abstract; 165 } 166 167 public void setAbstract(String value) { 168 _abstract = value; 169 } 170 171 public MarkupLine getSchemaName() { 172 return _schemaName; 173 } 174 175 public void setSchemaName(MarkupLine value) { 176 _schemaName = value; 177 } 178 179 public String getSchemaVersion() { 180 return _schemaVersion; 181 } 182 183 public void setSchemaVersion(String value) { 184 _schemaVersion = value; 185 } 186 187 public String getShortName() { 188 return _shortName; 189 } 190 191 public void setShortName(String value) { 192 _shortName = value; 193 } 194 195 public URI getNamespace() { 196 return _namespace; 197 } 198 199 public void setNamespace(URI value) { 200 _namespace = value; 201 } 202 203 public URI getJsonBaseUri() { 204 return _jsonBaseUri; 205 } 206 207 public void setJsonBaseUri(URI value) { 208 _jsonBaseUri = value; 209 } 210 211 public Remarks getRemarks() { 212 return _remarks; 213 } 214 215 public void setRemarks(Remarks value) { 216 _remarks = value; 217 } 218 219 public List<Import> getImports() { 220 return _imports; 221 } 222 223 public void setImports(List<Import> value) { 224 _imports = value; 225 } 226 227 /** 228 * Add a new {@link Import} item to the underlying collection. 229 * @param item the item to add 230 * @return {@code true} 231 */ 232 public boolean addImport(Import item) { 233 Import value = ObjectUtils.requireNonNull(item,"item cannot be null"); 234 if (_imports == null) { 235 _imports = new LinkedList<>(); 236 } 237 return _imports.add(value); 238 } 239 240 /** 241 * Remove the first matching {@link Import} item from the underlying collection. 242 * @param item the item to remove 243 * @return {@code true} if the item was removed or {@code false} otherwise 244 */ 245 public boolean removeImport(Import item) { 246 Import value = ObjectUtils.requireNonNull(item,"item cannot be null"); 247 return _imports != null && _imports.remove(value); 248 } 249 250 public List<MetapathNamespace> getNamespaceBindings() { 251 return _namespaceBindings; 252 } 253 254 public void setNamespaceBindings(List<MetapathNamespace> value) { 255 _namespaceBindings = value; 256 } 257 258 /** 259 * Add a new {@link MetapathNamespace} item to the underlying collection. 260 * @param item the item to add 261 * @return {@code true} 262 */ 263 public boolean addNamespaceBinding(MetapathNamespace item) { 264 MetapathNamespace value = ObjectUtils.requireNonNull(item,"item cannot be null"); 265 if (_namespaceBindings == null) { 266 _namespaceBindings = new LinkedList<>(); 267 } 268 return _namespaceBindings.add(value); 269 } 270 271 /** 272 * Remove the first matching {@link MetapathNamespace} item from the underlying collection. 273 * @param item the item to remove 274 * @return {@code true} if the item was removed or {@code false} otherwise 275 */ 276 public boolean removeNamespaceBinding(MetapathNamespace item) { 277 MetapathNamespace value = ObjectUtils.requireNonNull(item,"item cannot be null"); 278 return _namespaceBindings != null && _namespaceBindings.remove(value); 279 } 280 281 public List<Object> getDefinitions() { 282 return _definitions; 283 } 284 285 public void setDefinitions(List<Object> value) { 286 _definitions = value; 287 } 288 289 @Override 290 public String toString() { 291 return new ReflectionToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE).toString(); 292 } 293 294 /** 295 * Imports a set of Metaschema modules contained in another resource. Imports support the reuse of common information structures. 296 */ 297 @MetaschemaAssembly( 298 formalName = "Module Import", 299 description = "Imports a set of Metaschema modules contained in another resource. Imports support the reuse of common information structures.", 300 name = "import", 301 moduleClass = MetaschemaModelModule.class 302 ) 303 public static class Import implements IBoundObject { 304 private final IMetaschemaData __metaschemaData; 305 306 /** 307 * "A relative or absolute URI for retrieving an out-of-line Metaschema definition." 308 */ 309 @BoundFlag( 310 formalName = "Import URI Reference", 311 description = "A relative or absolute URI for retrieving an out-of-line Metaschema definition.", 312 name = "href", 313 required = true, 314 typeAdapter = UriReferenceAdapter.class 315 ) 316 private URI _href; 317 318 public Import() { 319 this(null); 320 } 321 322 public Import(IMetaschemaData data) { 323 this.__metaschemaData = data; 324 } 325 326 @Override 327 public IMetaschemaData getMetaschemaData() { 328 return __metaschemaData; 329 } 330 331 public URI getHref() { 332 return _href; 333 } 334 335 public void setHref(URI value) { 336 _href = value; 337 } 338 339 @Override 340 public String toString() { 341 return new ReflectionToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE).toString(); 342 } 343 } 344 345 /** 346 * In XML, an element with structured element content. In JSON, an object with properties. Defined globally, an assembly can be assigned to appear in the <code>model</code> of any assembly (another assembly type, or itself), by <code>assembly</code> reference. 347 */ 348 @MetaschemaAssembly( 349 formalName = "Global Assembly Definition", 350 description = "In XML, an element with structured element content. In JSON, an object with properties. Defined globally, an assembly can be assigned to appear in the `model` of any assembly (another assembly type, or itself), by `assembly` reference.", 351 name = "define-assembly", 352 moduleClass = MetaschemaModelModule.class 353 ) 354 public static class DefineAssembly implements IBoundObject { 355 private final IMetaschemaData __metaschemaData; 356 357 @BoundFlag( 358 formalName = "Global Assembly Name", 359 name = "name", 360 required = true, 361 typeAdapter = TokenAdapter.class 362 ) 363 private String _name; 364 365 @BoundFlag( 366 formalName = "Global Assembly Binary Name", 367 name = "index", 368 typeAdapter = PositiveIntegerAdapter.class 369 ) 370 private BigInteger _index; 371 372 @BoundFlag( 373 formalName = "Definition Scope", 374 name = "scope", 375 defaultValue = "global", 376 typeAdapter = TokenAdapter.class, 377 valueConstraints = @ValueConstraints(allowedValues = @AllowedValues(level = IConstraint.Level.ERROR, values = {@AllowedValue(value = "local", description = "This definition is only available in the context of the current Metaschema module."), @AllowedValue(value = "global", description = "This definition will be made available to any Metaschema module that includes this one either directly or indirectly through a chain of imported Metaschemas.")})) 378 ) 379 private String _scope; 380 381 @BoundFlag( 382 formalName = "Deprecated Version", 383 name = "deprecated", 384 typeAdapter = StringAdapter.class 385 ) 386 private String _deprecated; 387 388 @BoundField( 389 formalName = "Formal Name", 390 description = "A formal name for the data construct, to be presented in documentation.", 391 useName = "formal-name" 392 ) 393 private String _formalName; 394 395 @BoundField( 396 formalName = "Description", 397 description = "A short description of the data construct's purpose, describing the constructs semantics.", 398 useName = "description", 399 typeAdapter = MarkupLineAdapter.class 400 ) 401 private MarkupLine _description; 402 403 @BoundAssembly( 404 formalName = "Property", 405 useName = "prop", 406 maxOccurs = -1, 407 groupAs = @GroupAs(name = "props", inJson = JsonGroupAsBehavior.LIST) 408 ) 409 private List<Property> _props; 410 411 @BoundField( 412 formalName = "Use Name", 413 description = "Allows the name of the definition to be overridden.", 414 useName = "use-name" 415 ) 416 private UseName _useName; 417 418 @BoundField( 419 formalName = "Root Name", 420 description = "Provides a root name, for when the definition is used as the root of a node hierarchy.", 421 useName = "root-name", 422 minOccurs = 1 423 ) 424 private RootName _rootName; 425 426 @BoundAssembly( 427 formalName = "JSON Key", 428 description = "Used in JSON (and similar formats) to identify a flag that will be used as the property name in an object hold a collection of sibling objects. Requires that siblings must never share `json-key` values.", 429 useName = "json-key" 430 ) 431 private JsonKey _jsonKey; 432 433 @BoundChoiceGroup( 434 maxOccurs = -1, 435 assemblies = { 436 @BoundGroupedAssembly(formalName = "Inline Flag Definition", useName = "define-flag", binding = InlineDefineFlag.class), 437 @BoundGroupedAssembly(formalName = "Flag Reference", useName = "flag", binding = FlagReference.class) 438 }, 439 groupAs = @GroupAs(name = "flags", inJson = JsonGroupAsBehavior.LIST) 440 ) 441 private List<Object> _flags; 442 443 @BoundAssembly( 444 useName = "model" 445 ) 446 private AssemblyModel _model; 447 448 @BoundAssembly( 449 useName = "constraint" 450 ) 451 private AssemblyConstraints _constraint; 452 453 @BoundField( 454 formalName = "Remarks", 455 description = "Any explanatory or helpful information to be provided about the remarks parent.", 456 useName = "remarks" 457 ) 458 private Remarks _remarks; 459 460 @BoundAssembly( 461 formalName = "Example", 462 useName = "example", 463 maxOccurs = -1, 464 groupAs = @GroupAs(name = "examples", inJson = JsonGroupAsBehavior.LIST) 465 ) 466 private List<Example> _examples; 467 468 public DefineAssembly() { 469 this(null); 470 } 471 472 public DefineAssembly(IMetaschemaData data) { 473 this.__metaschemaData = data; 474 } 475 476 @Override 477 public IMetaschemaData getMetaschemaData() { 478 return __metaschemaData; 479 } 480 481 public String getName() { 482 return _name; 483 } 484 485 public void setName(String value) { 486 _name = value; 487 } 488 489 public BigInteger getIndex() { 490 return _index; 491 } 492 493 public void setIndex(BigInteger value) { 494 _index = value; 495 } 496 497 public String getScope() { 498 return _scope; 499 } 500 501 public void setScope(String value) { 502 _scope = value; 503 } 504 505 public String getDeprecated() { 506 return _deprecated; 507 } 508 509 public void setDeprecated(String value) { 510 _deprecated = value; 511 } 512 513 public String getFormalName() { 514 return _formalName; 515 } 516 517 public void setFormalName(String value) { 518 _formalName = value; 519 } 520 521 public MarkupLine getDescription() { 522 return _description; 523 } 524 525 public void setDescription(MarkupLine value) { 526 _description = value; 527 } 528 529 public List<Property> getProps() { 530 return _props; 531 } 532 533 public void setProps(List<Property> value) { 534 _props = value; 535 } 536 537 /** 538 * Add a new {@link Property} item to the underlying collection. 539 * @param item the item to add 540 * @return {@code true} 541 */ 542 public boolean addProp(Property item) { 543 Property value = ObjectUtils.requireNonNull(item,"item cannot be null"); 544 if (_props == null) { 545 _props = new LinkedList<>(); 546 } 547 return _props.add(value); 548 } 549 550 /** 551 * Remove the first matching {@link Property} item from the underlying collection. 552 * @param item the item to remove 553 * @return {@code true} if the item was removed or {@code false} otherwise 554 */ 555 public boolean removeProp(Property item) { 556 Property value = ObjectUtils.requireNonNull(item,"item cannot be null"); 557 return _props != null && _props.remove(value); 558 } 559 560 public UseName getUseName() { 561 return _useName; 562 } 563 564 public void setUseName(UseName value) { 565 _useName = value; 566 } 567 568 public RootName getRootName() { 569 return _rootName; 570 } 571 572 public void setRootName(RootName value) { 573 _rootName = value; 574 } 575 576 public JsonKey getJsonKey() { 577 return _jsonKey; 578 } 579 580 public void setJsonKey(JsonKey value) { 581 _jsonKey = value; 582 } 583 584 public List<Object> getFlags() { 585 return _flags; 586 } 587 588 public void setFlags(List<Object> value) { 589 _flags = value; 590 } 591 592 public AssemblyModel getModel() { 593 return _model; 594 } 595 596 public void setModel(AssemblyModel value) { 597 _model = value; 598 } 599 600 public AssemblyConstraints getConstraint() { 601 return _constraint; 602 } 603 604 public void setConstraint(AssemblyConstraints value) { 605 _constraint = value; 606 } 607 608 public Remarks getRemarks() { 609 return _remarks; 610 } 611 612 public void setRemarks(Remarks value) { 613 _remarks = value; 614 } 615 616 public List<Example> getExamples() { 617 return _examples; 618 } 619 620 public void setExamples(List<Example> value) { 621 _examples = value; 622 } 623 624 /** 625 * Add a new {@link Example} item to the underlying collection. 626 * @param item the item to add 627 * @return {@code true} 628 */ 629 public boolean addExample(Example item) { 630 Example value = ObjectUtils.requireNonNull(item,"item cannot be null"); 631 if (_examples == null) { 632 _examples = new LinkedList<>(); 633 } 634 return _examples.add(value); 635 } 636 637 /** 638 * Remove the first matching {@link Example} item from the underlying collection. 639 * @param item the item to remove 640 * @return {@code true} if the item was removed or {@code false} otherwise 641 */ 642 public boolean removeExample(Example item) { 643 Example value = ObjectUtils.requireNonNull(item,"item cannot be null"); 644 return _examples != null && _examples.remove(value); 645 } 646 647 @Override 648 public String toString() { 649 return new ReflectionToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE).toString(); 650 } 651 652 /** 653 * Provides a root name, for when the definition is used as the root of a node hierarchy. 654 */ 655 @MetaschemaField( 656 formalName = "Root Name", 657 description = "Provides a root name, for when the definition is used as the root of a node hierarchy.", 658 name = "root-name", 659 moduleClass = MetaschemaModelModule.class 660 ) 661 public static class RootName implements IBoundObject { 662 private final IMetaschemaData __metaschemaData; 663 664 /** 665 * "Used for binary formats instead of the textual name." 666 */ 667 @BoundFlag( 668 formalName = "Numeric Index", 669 description = "Used for binary formats instead of the textual name.", 670 name = "index", 671 typeAdapter = NonNegativeIntegerAdapter.class 672 ) 673 private BigInteger _index; 674 675 @BoundFieldValue( 676 valueKeyName = "name", 677 typeAdapter = TokenAdapter.class 678 ) 679 private String _name; 680 681 public RootName() { 682 this(null); 683 } 684 685 public RootName(IMetaschemaData data) { 686 this.__metaschemaData = data; 687 } 688 689 @Override 690 public IMetaschemaData getMetaschemaData() { 691 return __metaschemaData; 692 } 693 694 public BigInteger getIndex() { 695 return _index; 696 } 697 698 public void setIndex(BigInteger value) { 699 _index = value; 700 } 701 702 public String getName() { 703 return _name; 704 } 705 706 public void setName(String value) { 707 _name = value; 708 } 709 710 @Override 711 public String toString() { 712 return new ReflectionToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE).toString(); 713 } 714 } 715 } 716 717 @MetaschemaAssembly( 718 formalName = "Global Field Definition", 719 name = "define-field", 720 moduleClass = MetaschemaModelModule.class 721 ) 722 public static class DefineField implements IBoundObject { 723 private final IMetaschemaData __metaschemaData; 724 725 @BoundFlag( 726 formalName = "Global Field Name", 727 name = "name", 728 required = true, 729 typeAdapter = TokenAdapter.class 730 ) 731 private String _name; 732 733 @BoundFlag( 734 formalName = "Global Field Binary Name", 735 name = "index", 736 typeAdapter = PositiveIntegerAdapter.class 737 ) 738 private BigInteger _index; 739 740 @BoundFlag( 741 formalName = "Definition Scope", 742 name = "scope", 743 defaultValue = "global", 744 typeAdapter = TokenAdapter.class, 745 valueConstraints = @ValueConstraints(allowedValues = @AllowedValues(level = IConstraint.Level.ERROR, values = {@AllowedValue(value = "local", description = "This definition is only available in the context of the current Metaschema module."), @AllowedValue(value = "global", description = "This definition will be made available to any Metaschema module that includes this one either directly or indirectly through a chain of imported Metaschemas.")})) 746 ) 747 private String _scope; 748 749 @BoundFlag( 750 formalName = "Deprecated Version", 751 name = "deprecated", 752 typeAdapter = StringAdapter.class 753 ) 754 private String _deprecated; 755 756 @BoundFlag( 757 formalName = "Field Value Data Type", 758 name = "as-type", 759 defaultValue = "string", 760 typeAdapter = TokenAdapter.class, 761 valueConstraints = @ValueConstraints(allowedValues = @AllowedValues(level = IConstraint.Level.ERROR, allowOthers = true, values = {@AllowedValue(value = "markup-line", description = "The [markup-line](https://pages.nist.gov/metaschema/specification/datatypes/#markup-line) data type."), @AllowedValue(value = "markup-multiline", description = "The [markup-multiline](https://pages.nist.gov/metaschema/specification/datatypes/#markup-multiline) data type."), @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")})) 762 ) 763 private String _asType; 764 765 @BoundFlag( 766 formalName = "Default Field Value", 767 name = "default", 768 typeAdapter = StringAdapter.class 769 ) 770 private String _default; 771 772 @BoundField( 773 formalName = "Formal Name", 774 description = "A formal name for the data construct, to be presented in documentation.", 775 useName = "formal-name" 776 ) 777 private String _formalName; 778 779 @BoundField( 780 formalName = "Description", 781 description = "A short description of the data construct's purpose, describing the constructs semantics.", 782 useName = "description", 783 typeAdapter = MarkupLineAdapter.class 784 ) 785 private MarkupLine _description; 786 787 @BoundAssembly( 788 formalName = "Property", 789 useName = "prop", 790 maxOccurs = -1, 791 groupAs = @GroupAs(name = "props", inJson = JsonGroupAsBehavior.LIST) 792 ) 793 private List<Property> _props; 794 795 @BoundField( 796 formalName = "Use Name", 797 description = "Allows the name of the definition to be overridden.", 798 useName = "use-name" 799 ) 800 private UseName _useName; 801 802 @BoundAssembly( 803 formalName = "JSON Key", 804 description = "Used in JSON (and similar formats) to identify a flag that will be used as the property name in an object hold a collection of sibling objects. Requires that siblings must never share `json-key` values.", 805 useName = "json-key" 806 ) 807 private JsonKey _jsonKey; 808 809 @BoundField( 810 formalName = "Field Value JSON Property Name", 811 useName = "json-value-key", 812 typeAdapter = TokenAdapter.class 813 ) 814 private String _jsonValueKey; 815 816 @BoundAssembly( 817 formalName = "Flag Used as the Field Value's JSON Property Name", 818 useName = "json-value-key-flag" 819 ) 820 private JsonValueKeyFlag _jsonValueKeyFlag; 821 822 @BoundChoiceGroup( 823 maxOccurs = -1, 824 assemblies = { 825 @BoundGroupedAssembly(formalName = "Inline Flag Definition", useName = "define-flag", binding = InlineDefineFlag.class), 826 @BoundGroupedAssembly(formalName = "Flag Reference", useName = "flag", binding = FlagReference.class) 827 }, 828 groupAs = @GroupAs(name = "flags", inJson = JsonGroupAsBehavior.LIST) 829 ) 830 private List<Object> _flags; 831 832 @BoundAssembly( 833 useName = "constraint" 834 ) 835 private FieldConstraints _constraint; 836 837 @BoundField( 838 formalName = "Remarks", 839 description = "Any explanatory or helpful information to be provided about the remarks parent.", 840 useName = "remarks" 841 ) 842 private Remarks _remarks; 843 844 @BoundAssembly( 845 formalName = "Example", 846 useName = "example", 847 maxOccurs = -1, 848 groupAs = @GroupAs(name = "examples", inJson = JsonGroupAsBehavior.LIST) 849 ) 850 private List<Example> _examples; 851 852 public DefineField() { 853 this(null); 854 } 855 856 public DefineField(IMetaschemaData data) { 857 this.__metaschemaData = data; 858 } 859 860 @Override 861 public IMetaschemaData getMetaschemaData() { 862 return __metaschemaData; 863 } 864 865 public String getName() { 866 return _name; 867 } 868 869 public void setName(String value) { 870 _name = value; 871 } 872 873 public BigInteger getIndex() { 874 return _index; 875 } 876 877 public void setIndex(BigInteger value) { 878 _index = value; 879 } 880 881 public String getScope() { 882 return _scope; 883 } 884 885 public void setScope(String value) { 886 _scope = value; 887 } 888 889 public String getDeprecated() { 890 return _deprecated; 891 } 892 893 public void setDeprecated(String value) { 894 _deprecated = value; 895 } 896 897 public String getAsType() { 898 return _asType; 899 } 900 901 public void setAsType(String value) { 902 _asType = value; 903 } 904 905 public String getDefault() { 906 return _default; 907 } 908 909 public void setDefault(String value) { 910 _default = value; 911 } 912 913 public String getFormalName() { 914 return _formalName; 915 } 916 917 public void setFormalName(String value) { 918 _formalName = value; 919 } 920 921 public MarkupLine getDescription() { 922 return _description; 923 } 924 925 public void setDescription(MarkupLine value) { 926 _description = value; 927 } 928 929 public List<Property> getProps() { 930 return _props; 931 } 932 933 public void setProps(List<Property> value) { 934 _props = value; 935 } 936 937 /** 938 * Add a new {@link Property} item to the underlying collection. 939 * @param item the item to add 940 * @return {@code true} 941 */ 942 public boolean addProp(Property item) { 943 Property value = ObjectUtils.requireNonNull(item,"item cannot be null"); 944 if (_props == null) { 945 _props = new LinkedList<>(); 946 } 947 return _props.add(value); 948 } 949 950 /** 951 * Remove the first matching {@link Property} item from the underlying collection. 952 * @param item the item to remove 953 * @return {@code true} if the item was removed or {@code false} otherwise 954 */ 955 public boolean removeProp(Property item) { 956 Property value = ObjectUtils.requireNonNull(item,"item cannot be null"); 957 return _props != null && _props.remove(value); 958 } 959 960 public UseName getUseName() { 961 return _useName; 962 } 963 964 public void setUseName(UseName value) { 965 _useName = value; 966 } 967 968 public JsonKey getJsonKey() { 969 return _jsonKey; 970 } 971 972 public void setJsonKey(JsonKey value) { 973 _jsonKey = value; 974 } 975 976 public String getJsonValueKey() { 977 return _jsonValueKey; 978 } 979 980 public void setJsonValueKey(String value) { 981 _jsonValueKey = value; 982 } 983 984 public JsonValueKeyFlag getJsonValueKeyFlag() { 985 return _jsonValueKeyFlag; 986 } 987 988 public void setJsonValueKeyFlag(JsonValueKeyFlag value) { 989 _jsonValueKeyFlag = value; 990 } 991 992 public List<Object> getFlags() { 993 return _flags; 994 } 995 996 public void setFlags(List<Object> value) { 997 _flags = value; 998 } 999 1000 public FieldConstraints getConstraint() { 1001 return _constraint; 1002 } 1003 1004 public void setConstraint(FieldConstraints value) { 1005 _constraint = value; 1006 } 1007 1008 public Remarks getRemarks() { 1009 return _remarks; 1010 } 1011 1012 public void setRemarks(Remarks value) { 1013 _remarks = value; 1014 } 1015 1016 public List<Example> getExamples() { 1017 return _examples; 1018 } 1019 1020 public void setExamples(List<Example> value) { 1021 _examples = value; 1022 } 1023 1024 /** 1025 * Add a new {@link Example} item to the underlying collection. 1026 * @param item the item to add 1027 * @return {@code true} 1028 */ 1029 public boolean addExample(Example item) { 1030 Example value = ObjectUtils.requireNonNull(item,"item cannot be null"); 1031 if (_examples == null) { 1032 _examples = new LinkedList<>(); 1033 } 1034 return _examples.add(value); 1035 } 1036 1037 /** 1038 * Remove the first matching {@link Example} item from the underlying collection. 1039 * @param item the item to remove 1040 * @return {@code true} if the item was removed or {@code false} otherwise 1041 */ 1042 public boolean removeExample(Example item) { 1043 Example value = ObjectUtils.requireNonNull(item,"item cannot be null"); 1044 return _examples != null && _examples.remove(value); 1045 } 1046 1047 @Override 1048 public String toString() { 1049 return new ReflectionToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE).toString(); 1050 } 1051 } 1052 1053 @MetaschemaAssembly( 1054 formalName = "Global Flag Definition", 1055 name = "define-flag", 1056 moduleClass = MetaschemaModelModule.class 1057 ) 1058 public static class DefineFlag implements IBoundObject { 1059 private final IMetaschemaData __metaschemaData; 1060 1061 @BoundFlag( 1062 formalName = "Global Flag Name", 1063 name = "name", 1064 required = true, 1065 typeAdapter = TokenAdapter.class 1066 ) 1067 private String _name; 1068 1069 @BoundFlag( 1070 formalName = "Global Flag Binary Name", 1071 name = "index", 1072 typeAdapter = PositiveIntegerAdapter.class 1073 ) 1074 private BigInteger _index; 1075 1076 @BoundFlag( 1077 formalName = "Definition Scope", 1078 name = "scope", 1079 defaultValue = "global", 1080 typeAdapter = TokenAdapter.class, 1081 valueConstraints = @ValueConstraints(allowedValues = @AllowedValues(level = IConstraint.Level.ERROR, values = {@AllowedValue(value = "local", description = "This definition is only available in the context of the current Metaschema module."), @AllowedValue(value = "global", description = "This definition will be made available to any Metaschema module that includes this one either directly or indirectly through a chain of imported Metaschemas.")})) 1082 ) 1083 private String _scope; 1084 1085 @BoundFlag( 1086 formalName = "Deprecated Version", 1087 name = "deprecated", 1088 typeAdapter = StringAdapter.class 1089 ) 1090 private String _deprecated; 1091 1092 @BoundFlag( 1093 formalName = "Flag Value Data Type", 1094 name = "as-type", 1095 defaultValue = "string", 1096 typeAdapter = TokenAdapter.class, 1097 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")})) 1098 ) 1099 private String _asType; 1100 1101 @BoundFlag( 1102 formalName = "Default Flag Value", 1103 name = "default", 1104 typeAdapter = StringAdapter.class 1105 ) 1106 private String _default; 1107 1108 @BoundField( 1109 formalName = "Formal Name", 1110 description = "A formal name for the data construct, to be presented in documentation.", 1111 useName = "formal-name" 1112 ) 1113 private String _formalName; 1114 1115 @BoundField( 1116 formalName = "Description", 1117 description = "A short description of the data construct's purpose, describing the constructs semantics.", 1118 useName = "description", 1119 typeAdapter = MarkupLineAdapter.class 1120 ) 1121 private MarkupLine _description; 1122 1123 @BoundAssembly( 1124 formalName = "Property", 1125 useName = "prop", 1126 maxOccurs = -1, 1127 groupAs = @GroupAs(name = "props", inJson = JsonGroupAsBehavior.LIST) 1128 ) 1129 private List<Property> _props; 1130 1131 @BoundField( 1132 formalName = "Use Name", 1133 description = "Allows the name of the definition to be overridden.", 1134 useName = "use-name" 1135 ) 1136 private UseName _useName; 1137 1138 @BoundAssembly( 1139 useName = "constraint" 1140 ) 1141 private FlagConstraints _constraint; 1142 1143 @BoundField( 1144 formalName = "Remarks", 1145 description = "Any explanatory or helpful information to be provided about the remarks parent.", 1146 useName = "remarks" 1147 ) 1148 private Remarks _remarks; 1149 1150 @BoundAssembly( 1151 formalName = "Example", 1152 useName = "example", 1153 maxOccurs = -1, 1154 groupAs = @GroupAs(name = "examples", inJson = JsonGroupAsBehavior.LIST) 1155 ) 1156 private List<Example> _examples; 1157 1158 public DefineFlag() { 1159 this(null); 1160 } 1161 1162 public DefineFlag(IMetaschemaData data) { 1163 this.__metaschemaData = data; 1164 } 1165 1166 @Override 1167 public IMetaschemaData getMetaschemaData() { 1168 return __metaschemaData; 1169 } 1170 1171 public String getName() { 1172 return _name; 1173 } 1174 1175 public void setName(String value) { 1176 _name = value; 1177 } 1178 1179 public BigInteger getIndex() { 1180 return _index; 1181 } 1182 1183 public void setIndex(BigInteger value) { 1184 _index = value; 1185 } 1186 1187 public String getScope() { 1188 return _scope; 1189 } 1190 1191 public void setScope(String value) { 1192 _scope = value; 1193 } 1194 1195 public String getDeprecated() { 1196 return _deprecated; 1197 } 1198 1199 public void setDeprecated(String value) { 1200 _deprecated = value; 1201 } 1202 1203 public String getAsType() { 1204 return _asType; 1205 } 1206 1207 public void setAsType(String value) { 1208 _asType = value; 1209 } 1210 1211 public String getDefault() { 1212 return _default; 1213 } 1214 1215 public void setDefault(String value) { 1216 _default = value; 1217 } 1218 1219 public String getFormalName() { 1220 return _formalName; 1221 } 1222 1223 public void setFormalName(String value) { 1224 _formalName = value; 1225 } 1226 1227 public MarkupLine getDescription() { 1228 return _description; 1229 } 1230 1231 public void setDescription(MarkupLine value) { 1232 _description = value; 1233 } 1234 1235 public List<Property> getProps() { 1236 return _props; 1237 } 1238 1239 public void setProps(List<Property> value) { 1240 _props = value; 1241 } 1242 1243 /** 1244 * Add a new {@link Property} item to the underlying collection. 1245 * @param item the item to add 1246 * @return {@code true} 1247 */ 1248 public boolean addProp(Property item) { 1249 Property value = ObjectUtils.requireNonNull(item,"item cannot be null"); 1250 if (_props == null) { 1251 _props = new LinkedList<>(); 1252 } 1253 return _props.add(value); 1254 } 1255 1256 /** 1257 * Remove the first matching {@link Property} item from the underlying collection. 1258 * @param item the item to remove 1259 * @return {@code true} if the item was removed or {@code false} otherwise 1260 */ 1261 public boolean removeProp(Property item) { 1262 Property value = ObjectUtils.requireNonNull(item,"item cannot be null"); 1263 return _props != null && _props.remove(value); 1264 } 1265 1266 public UseName getUseName() { 1267 return _useName; 1268 } 1269 1270 public void setUseName(UseName value) { 1271 _useName = value; 1272 } 1273 1274 public FlagConstraints getConstraint() { 1275 return _constraint; 1276 } 1277 1278 public void setConstraint(FlagConstraints value) { 1279 _constraint = value; 1280 } 1281 1282 public Remarks getRemarks() { 1283 return _remarks; 1284 } 1285 1286 public void setRemarks(Remarks value) { 1287 _remarks = value; 1288 } 1289 1290 public List<Example> getExamples() { 1291 return _examples; 1292 } 1293 1294 public void setExamples(List<Example> value) { 1295 _examples = value; 1296 } 1297 1298 /** 1299 * Add a new {@link Example} item to the underlying collection. 1300 * @param item the item to add 1301 * @return {@code true} 1302 */ 1303 public boolean addExample(Example item) { 1304 Example value = ObjectUtils.requireNonNull(item,"item cannot be null"); 1305 if (_examples == null) { 1306 _examples = new LinkedList<>(); 1307 } 1308 return _examples.add(value); 1309 } 1310 1311 /** 1312 * Remove the first matching {@link Example} item from the underlying collection. 1313 * @param item the item to remove 1314 * @return {@code true} if the item was removed or {@code false} otherwise 1315 */ 1316 public boolean removeExample(Example item) { 1317 Example value = ObjectUtils.requireNonNull(item,"item cannot be null"); 1318 return _examples != null && _examples.remove(value); 1319 } 1320 1321 @Override 1322 public String toString() { 1323 return new ReflectionToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE).toString(); 1324 } 1325 } 1326}