001// Generated from: ../../../../../../../../oscal/src/metaschema/oscal_mapping-common_metaschema.xml
002// Do not edit - changes will be lost when regenerated.
003package dev.metaschema.oscal.lib.model;
004
005import dev.metaschema.core.datatype.adapter.DecimalAdapter;
006import dev.metaschema.core.datatype.adapter.StringAdapter;
007import dev.metaschema.core.model.IBoundObject;
008import dev.metaschema.core.model.IMetaschemaData;
009import dev.metaschema.core.model.constraint.IConstraint;
010import dev.metaschema.core.util.ObjectUtils;
011import dev.metaschema.databind.model.annotations.AllowedValue;
012import dev.metaschema.databind.model.annotations.AllowedValues;
013import dev.metaschema.databind.model.annotations.BoundFieldValue;
014import dev.metaschema.databind.model.annotations.BoundFlag;
015import dev.metaschema.databind.model.annotations.MetaschemaField;
016import dev.metaschema.databind.model.annotations.ValueConstraints;
017import edu.umd.cs.findbugs.annotations.Nullable;
018import java.math.BigDecimal;
019import org.apache.commons.lang3.builder.ReflectionToStringBuilder;
020import org.apache.commons.lang3.builder.ToStringStyle;
021
022/**
023 * This records either a string category or a decimal value from 0-1 representing a percentage. Both of these values describe an estimation of the author's confidence that this mapping is correct and accurate.
024 */
025@MetaschemaField(
026    formalName = "Confidence Score",
027    description = "This records either a string category or a decimal value from 0-1 representing a percentage. Both of these values describe an estimation of the author's confidence that this mapping is correct and accurate.",
028    name = "confidence-score",
029    moduleClass = OscalMappingCommonModule.class
030)
031public class ConfidenceScore implements IBoundObject {
032  private final IMetaschemaData __metaschemaData;
033
034  @BoundFlag(
035      name = "category",
036      typeAdapter = StringAdapter.class,
037      valueConstraints = @ValueConstraints(allowedValues = @AllowedValues(level = IConstraint.Level.ERROR, allowOthers = true, values = {@AllowedValue(value = "unspecified", description = "No category is specified for the confidence score."), @AllowedValue(value = "high", description = "High confidence in the mapping."), @AllowedValue(value = "medium", description = "Medium confidence in the mapping."), @AllowedValue(value = "low", description = "Low confidence in the mapping.")}))
038  )
039  private String _category;
040
041  @BoundFlag(
042      name = "percentage",
043      typeAdapter = DecimalAdapter.class
044  )
045  private BigDecimal _percentage;
046
047  /**
048   * The field value.
049   */
050  @BoundFieldValue(
051      valueKeyName = "STRVALUE"
052  )
053  private String _value;
054
055  /**
056   * Constructs a new {@code dev.metaschema.oscal.lib.model.ConfidenceScore} instance with no metadata.
057   */
058  public ConfidenceScore() {
059    this(null);
060  }
061
062  /**
063   * Constructs a new {@code dev.metaschema.oscal.lib.model.ConfidenceScore} instance with the specified metadata.
064   *
065   * @param data
066   *           the metaschema data, or {@code null} if none
067   */
068  public ConfidenceScore(IMetaschemaData data) {
069    this.__metaschemaData = data;
070  }
071
072  @Override
073  public IMetaschemaData getMetaschemaData() {
074    return __metaschemaData;
075  }
076
077  /**
078   * Get the {@code category} property.
079   *
080   * @return the category value, or {@code null} if not set
081   */
082  @Nullable
083  public String getCategory() {
084    return _category;
085  }
086
087  /**
088   * Set the {@code category} property.
089   *
090   * @param value
091   *           the category value to set, or {@code null} to clear
092   */
093  public void setCategory(@Nullable String value) {
094    _category = value;
095  }
096
097  /**
098   * Get the {@code percentage} property.
099   *
100   * @return the percentage value, or {@code null} if not set
101   */
102  @Nullable
103  public BigDecimal getPercentage() {
104    return _percentage;
105  }
106
107  /**
108   * Set the {@code percentage} property.
109   *
110   * @param value
111   *           the percentage value to set, or {@code null} to clear
112   */
113  public void setPercentage(@Nullable BigDecimal value) {
114    _percentage = value;
115  }
116
117  /**
118   * Get the field value.
119   *
120   * @return the value
121   */
122  @Nullable
123  public String getValue() {
124    return _value;
125  }
126
127  /**
128   * Set the field value.
129   *
130   * @param value
131   *           the value to set
132   */
133  public void setValue(@Nullable String value) {
134    _value = value;
135  }
136
137  @Override
138  public String toString() {
139    return ObjectUtils.notNull(new ReflectionToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE).toString());
140  }
141}