001// Generated from: ../../../../../../../../oscal/src/metaschema/oscal_implementation-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.StringAdapter; 006import dev.metaschema.core.datatype.adapter.TokenAdapter; 007import dev.metaschema.core.datatype.markup.MarkupMultiline; 008import dev.metaschema.core.datatype.markup.MarkupMultilineAdapter; 009import dev.metaschema.core.model.IBoundObject; 010import dev.metaschema.core.model.IMetaschemaData; 011import dev.metaschema.core.model.JsonGroupAsBehavior; 012import dev.metaschema.core.util.ObjectUtils; 013import dev.metaschema.databind.model.annotations.BoundField; 014import dev.metaschema.databind.model.annotations.BoundFlag; 015import dev.metaschema.databind.model.annotations.GroupAs; 016import dev.metaschema.databind.model.annotations.MetaschemaAssembly; 017import edu.umd.cs.findbugs.annotations.NonNull; 018import edu.umd.cs.findbugs.annotations.Nullable; 019import java.util.LinkedList; 020import java.util.List; 021import org.apache.commons.lang3.builder.ReflectionToStringBuilder; 022import org.apache.commons.lang3.builder.ToStringStyle; 023 024/** 025 * Identifies the parameter that will be set by the enclosed value. 026 */ 027@MetaschemaAssembly( 028 formalName = "Set Parameter Value", 029 description = "Identifies the parameter that will be set by the enclosed value.", 030 name = "set-parameter", 031 moduleClass = OscalImplementationCommonModule.class 032) 033public class SetParameter implements IBoundObject { 034 private final IMetaschemaData __metaschemaData; 035 036 /** 037 * A <a href="https://pages.nist.gov/OSCAL/concepts/identifier-use/#human-oriented">human-oriented</a> reference to a <code>parameter</code> within a control, who's catalog has been imported into the current implementation context. 038 */ 039 @BoundFlag( 040 formalName = "Parameter ID", 041 description = "A [human-oriented](https://pages.nist.gov/OSCAL/concepts/identifier-use/#human-oriented) reference to a `parameter` within a control, who's catalog has been imported into the current implementation context.", 042 name = "param-id", 043 required = true, 044 typeAdapter = TokenAdapter.class 045 ) 046 private String _paramId; 047 048 /** 049 * A parameter value or set of values. 050 */ 051 @BoundField( 052 formalName = "Parameter Value", 053 description = "A parameter value or set of values.", 054 useName = "value", 055 minOccurs = 1, 056 maxOccurs = -1, 057 groupAs = @GroupAs(name = "values", inJson = JsonGroupAsBehavior.LIST), 058 typeAdapter = StringAdapter.class 059 ) 060 private List<String> _values; 061 062 /** 063 * Additional commentary about the containing object. 064 */ 065 @BoundField( 066 formalName = "Remarks", 067 description = "Additional commentary about the containing object.", 068 useName = "remarks", 069 typeAdapter = MarkupMultilineAdapter.class 070 ) 071 private MarkupMultiline _remarks; 072 073 /** 074 * Constructs a new {@code dev.metaschema.oscal.lib.model.SetParameter} instance with no metadata. 075 */ 076 public SetParameter() { 077 this(null); 078 } 079 080 /** 081 * Constructs a new {@code dev.metaschema.oscal.lib.model.SetParameter} instance with the specified metadata. 082 * 083 * @param data 084 * the metaschema data, or {@code null} if none 085 */ 086 public SetParameter(IMetaschemaData data) { 087 this.__metaschemaData = data; 088 } 089 090 @Override 091 public IMetaschemaData getMetaschemaData() { 092 return __metaschemaData; 093 } 094 095 /** 096 * Get the "{@literal Parameter ID}". 097 * 098 * <p> 099 * A <a href="https://pages.nist.gov/OSCAL/concepts/identifier-use/#human-oriented">human-oriented</a> reference to a <code>parameter</code> within a control, who's catalog has been imported into the current implementation context. 100 * 101 * @return the param-id value 102 */ 103 @NonNull 104 public String getParamId() { 105 return _paramId; 106 } 107 108 /** 109 * Set the "{@literal Parameter ID}". 110 * 111 * <p> 112 * A <a href="https://pages.nist.gov/OSCAL/concepts/identifier-use/#human-oriented">human-oriented</a> reference to a <code>parameter</code> within a control, who's catalog has been imported into the current implementation context. 113 * 114 * @param value 115 * the param-id value to set 116 */ 117 public void setParamId(@NonNull String value) { 118 _paramId = value; 119 } 120 121 /** 122 * Get the "{@literal Parameter Value}". 123 * 124 * <p> 125 * A parameter value or set of values. 126 * 127 * @return the value value 128 */ 129 @NonNull 130 public List<String> getValues() { 131 if (_values == null) { 132 _values = new LinkedList<>(); 133 } 134 return ObjectUtils.notNull(_values); 135 } 136 137 /** 138 * Set the "{@literal Parameter Value}". 139 * 140 * <p> 141 * A parameter value or set of values. 142 * 143 * @param value 144 * the value value to set 145 */ 146 public void setValues(@NonNull List<String> value) { 147 _values = value; 148 } 149 150 /** 151 * Add a new {@link String} item to the underlying collection. 152 * @param item the item to add 153 * @return {@code true} 154 */ 155 public boolean addValue(String item) { 156 String value = ObjectUtils.requireNonNull(item,"item cannot be null"); 157 if (_values == null) { 158 _values = new LinkedList<>(); 159 } 160 return _values.add(value); 161 } 162 163 /** 164 * Remove the first matching {@link String} item from the underlying collection. 165 * @param item the item to remove 166 * @return {@code true} if the item was removed or {@code false} otherwise 167 */ 168 public boolean removeValue(String item) { 169 String value = ObjectUtils.requireNonNull(item,"item cannot be null"); 170 return _values != null && _values.remove(value); 171 } 172 173 /** 174 * Get the "{@literal Remarks}". 175 * 176 * <p> 177 * Additional commentary about the containing object. 178 * 179 * @return the remarks value, or {@code null} if not set 180 */ 181 @Nullable 182 public MarkupMultiline getRemarks() { 183 return _remarks; 184 } 185 186 /** 187 * Set the "{@literal Remarks}". 188 * 189 * <p> 190 * Additional commentary about the containing object. 191 * 192 * @param value 193 * the remarks value to set, or {@code null} to clear 194 */ 195 public void setRemarks(@Nullable MarkupMultiline value) { 196 _remarks = value; 197 } 198 199 @Override 200 public String toString() { 201 return ObjectUtils.notNull(new ReflectionToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE).toString()); 202 } 203}