PropertyBag.java
package org.schemastore.json.sarif.x210;
import gov.nist.secauto.metaschema.core.model.IBoundObject;
import gov.nist.secauto.metaschema.core.model.IMetaschemaData;
import gov.nist.secauto.metaschema.core.model.JsonGroupAsBehavior;
import gov.nist.secauto.metaschema.core.util.ObjectUtils;
import gov.nist.secauto.metaschema.databind.model.annotations.BoundField;
import gov.nist.secauto.metaschema.databind.model.annotations.GroupAs;
import gov.nist.secauto.metaschema.databind.model.annotations.MetaschemaAssembly;
import java.lang.Override;
import java.lang.String;
import java.util.LinkedList;
import java.util.List;
import org.apache.commons.lang3.builder.ReflectionToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
/**
* Key/value pairs that provide additional information about the object.
*/
@MetaschemaAssembly(
formalName = "Property Bag",
description = "Key/value pairs that provide additional information about the object.",
name = "propertyBag",
moduleClass = SarifModule.class
)
public class PropertyBag implements IBoundObject {
private final IMetaschemaData __metaschemaData;
@BoundField(
formalName = "Tag",
description = "A set of distinct strings that provide additional information.",
useName = "tag",
maxOccurs = -1,
groupAs = @GroupAs(name = "tags", inJson = JsonGroupAsBehavior.LIST)
)
private List<String> _tags;
public PropertyBag() {
this(null);
}
public PropertyBag(IMetaschemaData data) {
this.__metaschemaData = data;
}
@Override
public IMetaschemaData getMetaschemaData() {
return __metaschemaData;
}
public List<String> getTags() {
return _tags;
}
public void setTags(List<String> value) {
_tags = value;
}
/**
* Add a new {@link String} item to the underlying collection.
* @param item the item to add
* @return {@code true}
*/
public boolean addTag(String item) {
String value = ObjectUtils.requireNonNull(item,"item cannot be null");
if (_tags == null) {
_tags = new LinkedList<>();
}
return _tags.add(value);
}
/**
* Remove the first matching {@link String} item from the underlying collection.
* @param item the item to remove
* @return {@code true} if the item was removed or {@code false} otherwise
*/
public boolean removeTag(String item) {
String value = ObjectUtils.requireNonNull(item,"item cannot be null");
return _tags != null && _tags.remove(value);
}
@Override
public String toString() {
return new ReflectionToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE).toString();
}
}