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 @BoundFlag( 035 name = "generation-method", 036 defaultValue = "arbitrary", 037 typeAdapter = StringAdapter.class, 038 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."))) 039 ) 040 private String _generationMethod; 041 042 /** 043 * The field value. 044 */ 045 @BoundFieldValue( 046 valueKeyName = "STRVALUE", 047 typeAdapter = DecimalAdapter.class 048 ) 049 private BigDecimal _value; 050 051 /** 052 * Constructs a new {@code dev.metaschema.oscal.lib.model.Coverage} instance with no metadata. 053 */ 054 public Coverage() { 055 this(null); 056 } 057 058 /** 059 * Constructs a new {@code dev.metaschema.oscal.lib.model.Coverage} instance with the specified metadata. 060 * 061 * @param data 062 * the metaschema data, or {@code null} if none 063 */ 064 public Coverage(IMetaschemaData data) { 065 this.__metaschemaData = data; 066 } 067 068 @Override 069 public IMetaschemaData getMetaschemaData() { 070 return __metaschemaData; 071 } 072 073 /** 074 * Get the {@code generation-method} property. 075 * 076 * @return the generation-method value, or {@code null} if not set 077 */ 078 @Nullable 079 public String getGenerationMethod() { 080 return _generationMethod; 081 } 082 083 /** 084 * Set the {@code generation-method} property. 085 * 086 * @param value 087 * the generation-method value to set, or {@code null} to clear 088 */ 089 public void setGenerationMethod(@Nullable String value) { 090 _generationMethod = value; 091 } 092 093 /** 094 * Get the field value. 095 * 096 * @return the value 097 */ 098 @Nullable 099 public BigDecimal getValue() { 100 return _value; 101 } 102 103 /** 104 * Set the field value. 105 * 106 * @param value 107 * the value to set 108 */ 109 public void setValue(@Nullable BigDecimal value) { 110 _value = value; 111 } 112 113 @Override 114 public String toString() { 115 return ObjectUtils.notNull(new ReflectionToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE).toString()); 116 } 117}