Sarif.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.model.constraint.IConstraint;
import gov.nist.secauto.metaschema.core.util.ObjectUtils;
import gov.nist.secauto.metaschema.databind.model.annotations.AllowedValue;
import gov.nist.secauto.metaschema.databind.model.annotations.AllowedValues;
import gov.nist.secauto.metaschema.databind.model.annotations.BoundAssembly;
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 gov.nist.secauto.metaschema.databind.model.annotations.ValueConstraints;
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;
/**
* A standard format for the output of static analysis tools.
*/
@MetaschemaAssembly(
formalName = "Static Analysis Results Interchange Format",
description = "A standard format for the output of static analysis tools.",
name = "sarif",
moduleClass = SarifModule.class,
rootName = "sarif",
remarks = "Note, Metaschema does not support an anonymous top-level assembly without a key name in JSON and YAML, which is required for SARIF."
)
public class Sarif implements IBoundObject {
private final IMetaschemaData __metaschemaData;
@BoundField(
formalName = "SARIF Model Version",
description = "The version of the SARIF Model used for conforming instances.",
useName = "version",
valueConstraints = @ValueConstraints(allowedValues = @AllowedValues(level = IConstraint.Level.ERROR, values = @AllowedValue(value = "2.1.0", description = "")))
)
private String _version;
@BoundAssembly(
formalName = "Run",
description = "Describes a single run of an analysis tool, and contains the reported output of that run.",
useName = "run",
maxOccurs = -1,
groupAs = @GroupAs(name = "runs", inJson = JsonGroupAsBehavior.LIST)
)
private List<Run> _runs;
public Sarif() {
this(null);
}
public Sarif(IMetaschemaData data) {
this.__metaschemaData = data;
}
@Override
public IMetaschemaData getMetaschemaData() {
return __metaschemaData;
}
public String getVersion() {
return _version;
}
public void setVersion(String value) {
_version = value;
}
public List<Run> getRuns() {
return _runs;
}
public void setRuns(List<Run> value) {
_runs = value;
}
/**
* Add a new {@link Run} item to the underlying collection.
* @param item the item to add
* @return {@code true}
*/
public boolean addRun(Run item) {
Run value = ObjectUtils.requireNonNull(item,"item cannot be null");
if (_runs == null) {
_runs = new LinkedList<>();
}
return _runs.add(value);
}
/**
* Remove the first matching {@link Run} 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 removeRun(Run item) {
Run value = ObjectUtils.requireNonNull(item,"item cannot be null");
return _runs != null && _runs.remove(value);
}
@Override
public String toString() {
return new ReflectionToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE).toString();
}
}