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 * A decimal value from 0-1, representing the percentage coverage of the targets by the sources. 024 */ 025@MetaschemaField( 026 formalName = "Coverage", 027 description = "A decimal value from 0-1, representing the percentage coverage of the targets by the sources.", 028 name = "coverage", 029 moduleClass = OscalMappingCommonModule.class 030) 031public class Coverage implements IBoundObject { 032 private final IMetaschemaData __metaschemaData; 033 034 /** 035 * The method used to determine the coverage value. 036 */ 037 @BoundFlag( 038 formalName = "Coverage Generation Method", 039 description = "The method used to determine the coverage value.", 040 name = "generation-method", 041 defaultValue = "arbitrary", 042 typeAdapter = StringAdapter.class, 043 valueConstraints = @ValueConstraints(allowedValues = @AllowedValues(id = "oscal-mapping-coverage-generation-method-values", level = IConstraint.Level.ERROR, allowOthers = true, values = @AllowedValue(value = "arbitrary", description = "The coverage value is a qualitative estimate of coverage with no strict formula."))) 044 ) 045 private String _generationMethod; 046 047 /** 048 * The field value. 049 */ 050 @BoundFieldValue( 051 valueKeyName = "target-coverage", 052 typeAdapter = DecimalAdapter.class 053 ) 054 private BigDecimal _targetCoverage; 055 056 /** 057 * Constructs a new {@code dev.metaschema.oscal.lib.model.Coverage} instance with no metadata. 058 */ 059 public Coverage() { 060 this(null); 061 } 062 063 /** 064 * Constructs a new {@code dev.metaschema.oscal.lib.model.Coverage} instance with the specified metadata. 065 * 066 * @param data 067 * the metaschema data, or {@code null} if none 068 */ 069 public Coverage(IMetaschemaData data) { 070 this.__metaschemaData = data; 071 } 072 073 @Override 074 public IMetaschemaData getMetaschemaData() { 075 return __metaschemaData; 076 } 077 078 /** 079 * Get the "{@literal Coverage Generation Method}". 080 * 081 * <p> 082 * The method used to determine the coverage value. 083 * 084 * @return the generation-method value, or {@code null} if not set 085 */ 086 @Nullable 087 public String getGenerationMethod() { 088 return _generationMethod; 089 } 090 091 /** 092 * Set the "{@literal Coverage Generation Method}". 093 * 094 * <p> 095 * The method used to determine the coverage value. 096 * 097 * @param value 098 * the generation-method value to set, or {@code null} to clear 099 */ 100 public void setGenerationMethod(@Nullable String value) { 101 _generationMethod = value; 102 } 103 104 /** 105 * Get the field value. 106 * 107 * @return the value 108 */ 109 @Nullable 110 public BigDecimal getTargetCoverage() { 111 return _targetCoverage; 112 } 113 114 /** 115 * Set the field value. 116 * 117 * @param value 118 * the value to set 119 */ 120 public void setTargetCoverage(@Nullable BigDecimal value) { 121 _targetCoverage = value; 122 } 123 124 @Override 125 public String toString() { 126 return ObjectUtils.notNull(new ReflectionToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE).toString()); 127 } 128}