001package gov.nist.secauto.oscal.lib.model;
002
003import gov.nist.secauto.metaschema.core.datatype.adapter.DecimalAdapter;
004import gov.nist.secauto.metaschema.core.datatype.adapter.StringAdapter;
005import gov.nist.secauto.metaschema.core.model.IBoundObject;
006import gov.nist.secauto.metaschema.core.model.IMetaschemaData;
007import gov.nist.secauto.metaschema.core.model.constraint.IConstraint;
008import gov.nist.secauto.metaschema.databind.model.annotations.AllowedValue;
009import gov.nist.secauto.metaschema.databind.model.annotations.AllowedValues;
010import gov.nist.secauto.metaschema.databind.model.annotations.BoundFieldValue;
011import gov.nist.secauto.metaschema.databind.model.annotations.BoundFlag;
012import gov.nist.secauto.metaschema.databind.model.annotations.MetaschemaField;
013import gov.nist.secauto.metaschema.databind.model.annotations.ValueConstraints;
014import java.lang.Override;
015import java.lang.String;
016import java.math.BigDecimal;
017import org.apache.commons.lang3.builder.ReflectionToStringBuilder;
018import org.apache.commons.lang3.builder.ToStringStyle;
019
020/**
021 * A decimal value from 0-1, representing the percentage coverage of the targets by the sources.
022 */
023@MetaschemaField(
024    formalName = "Coverage",
025    description = "A decimal value from 0-1, representing the percentage coverage of the targets by the sources.",
026    name = "coverage",
027    moduleClass = OscalMappingCommonModule.class
028)
029public class Coverage implements IBoundObject {
030  private final IMetaschemaData __metaschemaData;
031
032  @BoundFlag(
033      name = "generation-method",
034      defaultValue = "arbitrary",
035      typeAdapter = StringAdapter.class,
036      valueConstraints = @ValueConstraints(allowedValues = @AllowedValues(level = IConstraint.Level.ERROR, allowOthers = true, values = @AllowedValue(value = "arbitrary", description = "The coverage value is a qualitative estimate of coverage with no strict formula.")))
037  )
038  private String _generationMethod;
039
040  @BoundFieldValue(
041      valueKeyName = "STRVALUE",
042      typeAdapter = DecimalAdapter.class
043  )
044  private BigDecimal _value;
045
046  public Coverage() {
047    this(null);
048  }
049
050  public Coverage(IMetaschemaData data) {
051    this.__metaschemaData = data;
052  }
053
054  @Override
055  public IMetaschemaData getMetaschemaData() {
056    return __metaschemaData;
057  }
058
059  public String getGenerationMethod() {
060    return _generationMethod;
061  }
062
063  public void setGenerationMethod(String value) {
064    _generationMethod = value;
065  }
066
067  public BigDecimal getValue() {
068    return _value;
069  }
070
071  public void setValue(BigDecimal value) {
072    _value = value;
073  }
074
075  @Override
076  public String toString() {
077    return new ReflectionToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE).toString();
078  }
079}