001package org.schemastore.json.sarif.x210;
002
003import gov.nist.secauto.metaschema.core.datatype.adapter.IntegerAdapter;
004import gov.nist.secauto.metaschema.core.datatype.adapter.NonNegativeIntegerAdapter;
005import gov.nist.secauto.metaschema.core.datatype.adapter.PositiveIntegerAdapter;
006import gov.nist.secauto.metaschema.core.model.IBoundObject;
007import gov.nist.secauto.metaschema.core.model.IMetaschemaData;
008import gov.nist.secauto.metaschema.core.model.constraint.IConstraint;
009import gov.nist.secauto.metaschema.databind.model.annotations.BoundAssembly;
010import gov.nist.secauto.metaschema.databind.model.annotations.BoundField;
011import gov.nist.secauto.metaschema.databind.model.annotations.Expect;
012import gov.nist.secauto.metaschema.databind.model.annotations.MetaschemaAssembly;
013import gov.nist.secauto.metaschema.databind.model.annotations.ValueConstraints;
014import java.lang.Override;
015import java.lang.String;
016import java.math.BigInteger;
017import org.apache.commons.lang3.builder.ReflectionToStringBuilder;
018import org.apache.commons.lang3.builder.ToStringStyle;
019
020/**
021 * A region within an artifact where a result was detected.
022 */
023@MetaschemaAssembly(
024    formalName = "Region",
025    description = "A region within an artifact where a result was detected.",
026    name = "region",
027    moduleClass = SarifModule.class,
028    valueConstraints = @ValueConstraints(expect = @Expect(level = IConstraint.Level.ERROR, test = "exists(startLine|charOffset|byteOffset)", message = "At least a startLine, charOffset, or byteOffset must be provided."))
029)
030public class Region implements IBoundObject {
031  private final IMetaschemaData __metaschemaData;
032
033  @BoundField(
034      formalName = "Start Line",
035      description = "The line number of the first character in the region.",
036      useName = "startLine",
037      typeAdapter = PositiveIntegerAdapter.class
038  )
039  private BigInteger _startLine;
040
041  @BoundField(
042      formalName = "Start Column",
043      description = "The column number of the first character in the region.",
044      useName = "startColumn",
045      typeAdapter = PositiveIntegerAdapter.class
046  )
047  private BigInteger _startColumn;
048
049  @BoundField(
050      formalName = "End Line",
051      description = "The line number of the last character in the region.",
052      useName = "endLine",
053      typeAdapter = PositiveIntegerAdapter.class
054  )
055  private BigInteger _endLine;
056
057  @BoundField(
058      formalName = "End Column",
059      description = "The column number of the character following the end of the region.",
060      useName = "endColumn",
061      typeAdapter = PositiveIntegerAdapter.class
062  )
063  private BigInteger _endColumn;
064
065  @BoundField(
066      formalName = "Character Offset",
067      description = "The zero-based offset from the beginning of the artifact of the first character in the region.",
068      useName = "charOffset",
069      defaultValue = "-1",
070      typeAdapter = IntegerAdapter.class,
071      valueConstraints = @ValueConstraints(expect = @Expect(level = IConstraint.Level.ERROR, test = "@id >= -1", message = "The offset '{ . }' is not greater than or equal to '-1'."))
072  )
073  private BigInteger _charOffset;
074
075  @BoundField(
076      formalName = "Character Length",
077      description = "The length of the region in characters.",
078      useName = "charLength",
079      typeAdapter = NonNegativeIntegerAdapter.class
080  )
081  private BigInteger _charLength;
082
083  @BoundField(
084      formalName = "Byte Offset",
085      description = "The zero-based offset from the beginning of the artifact of the first byte in the region",
086      useName = "byteOffset",
087      defaultValue = "-1",
088      typeAdapter = IntegerAdapter.class,
089      valueConstraints = @ValueConstraints(expect = @Expect(level = IConstraint.Level.ERROR, test = "@id >= -1", message = "The offset '{ . }' is not greater than or equal to '-1'."))
090  )
091  private BigInteger _byteOffset;
092
093  @BoundField(
094      formalName = "Byte Length",
095      description = "The length of the region in bytes.",
096      useName = "byteLength",
097      typeAdapter = NonNegativeIntegerAdapter.class
098  )
099  private BigInteger _byteLength;
100
101  @BoundAssembly(
102      formalName = "Region Message",
103      description = "A message relevant to the region.",
104      useName = "message"
105  )
106  private Message _message;
107
108  public Region() {
109    this(null);
110  }
111
112  public Region(IMetaschemaData data) {
113    this.__metaschemaData = data;
114  }
115
116  @Override
117  public IMetaschemaData getMetaschemaData() {
118    return __metaschemaData;
119  }
120
121  public BigInteger getStartLine() {
122    return _startLine;
123  }
124
125  public void setStartLine(BigInteger value) {
126    _startLine = value;
127  }
128
129  public BigInteger getStartColumn() {
130    return _startColumn;
131  }
132
133  public void setStartColumn(BigInteger value) {
134    _startColumn = value;
135  }
136
137  public BigInteger getEndLine() {
138    return _endLine;
139  }
140
141  public void setEndLine(BigInteger value) {
142    _endLine = value;
143  }
144
145  public BigInteger getEndColumn() {
146    return _endColumn;
147  }
148
149  public void setEndColumn(BigInteger value) {
150    _endColumn = value;
151  }
152
153  public BigInteger getCharOffset() {
154    return _charOffset;
155  }
156
157  public void setCharOffset(BigInteger value) {
158    _charOffset = value;
159  }
160
161  public BigInteger getCharLength() {
162    return _charLength;
163  }
164
165  public void setCharLength(BigInteger value) {
166    _charLength = value;
167  }
168
169  public BigInteger getByteOffset() {
170    return _byteOffset;
171  }
172
173  public void setByteOffset(BigInteger value) {
174    _byteOffset = value;
175  }
176
177  public BigInteger getByteLength() {
178    return _byteLength;
179  }
180
181  public void setByteLength(BigInteger value) {
182    _byteLength = value;
183  }
184
185  public Message getMessage() {
186    return _message;
187  }
188
189  public void setMessage(Message value) {
190    _message = value;
191  }
192
193  @Override
194  public String toString() {
195    return new ReflectionToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE).toString();
196  }
197}