* <p>The field value will be validated before it is set.
* If it is not valid, then an exception will be thrown.
* The meaning of validity is dependent on the descriptor
* implementation.</p>
*
* @param fieldName The field name to be set. Cannot be null or empty.
* @param fieldValue The field value to be set for the field
* name. Can be null if that is a valid value for the field.
*
* @exception RuntimeOperationsException if the field name or field value
* is illegal (wrapped exception is {@link IllegalArgumentException}); or
* if the descriptor is immutable (wrapped exception is
* {@link UnsupportedOperationException}).
*/
public void setField(String fieldName, Object fieldValue)
throws RuntimeOperationsException;
/**
* Returns all of the fields contained in this descriptor as a string array.
*
* @return String array of fields in the format <i>fieldName=fieldValue</i>
* <br>If the value of a field is not a String, then the toString() method
* will be called on it and the returned value, enclosed in parentheses,
* used as the value for the field in the returned array. If the value
* of a field is null, then the value of the field in the returned array
* will be empty. If the descriptor is empty, you will get
* an empty array.
*
* @see #setFields
*/
public String[] getFields();
/**
* Returns all the field names in the descriptor.
*
* @return String array of field names. If the descriptor is empty,
* you will get an empty array.
*/
public String[] getFieldNames();
/**
* Returns all the field values in the descriptor as an array of Objects. The
* returned values are in the same order as the {@code fieldNames} String array parameter.
*
* @param fieldNames String array of the names of the fields that
* the values should be returned for. If the array is empty then
* an empty array will be returned. If the array is null then all
* values will be returned, as if the parameter were the array
* returned by {@link #getFieldNames()}. If a field name in the
* array does not exist, including the case where it is null or
* the empty string, then null is returned for the matching array
* element being returned.
*
* @return Object array of field values. If the list of {@code fieldNames}
* is empty, you will get an empty array.
*/
public Object[] getFieldValues(String... fieldNames);
/**
* Removes a field from the descriptor.
*
* @param fieldName String name of the field to be removed.
* If the field name is illegal or the field is not found,
* no exception is thrown.
*
* @exception RuntimeOperationsException if a field of the given name
* exists and the descriptor is immutable. The wrapped exception will
* be an {@link UnsupportedOperationException}.
*/
public void removeField(String fieldName);
/**
* <p>Sets all fields in the field names array to the new value with
* the same index in the field values array. Array sizes must match.</p>
*
* <p>The field value will be validated before it is set.
* If it is not valid, then an exception will be thrown.
* If the arrays are empty, then no change will take effect.</p>
*
* @param fieldNames String array of field names. The array and array
* elements cannot be null.
* @param fieldValues Object array of the corresponding field values.
* The array cannot be null. Elements of the array can be null.
*
* @throws RuntimeOperationsException if the change fails for any reason.
* Wrapped exception is {@link IllegalArgumentException} if
* {@code fieldNames} or {@code fieldValues} is null, or if
* the arrays are of different lengths, or if there is an
* illegal value in one of them.
* Wrapped exception is {@link UnsupportedOperationException}
* if the descriptor is immutable, and the call would change
* its contents.
*
* @see #getFields
*/
public void setFields(String[] fieldNames, Object[] fieldValues)
throws RuntimeOperationsException;
=4= |