commonj.connector.metadata.discovery.properties
Interface MultiValuedProperty

All Superinterfaces:
Cloneable, Property, PropertyDescriptor, SingleTypedProperty
All Known Subinterfaces:
BoundedMultiValuedProperty, MultiFileProperty, MultiFolderProperty, MultiJavaTypeProperty, MultiSchemaTypeProperty

public interface MultiValuedProperty
extends SingleTypedProperty, Cloneable

A property descriptor that represents a multiple valued property such as an array, vector, collection, etc. A MultiValuedProperty has no bounds on the size of values it can hold.

Since:
1.0

Field Summary
static int MULTI_SELECT
          Constant indicating many values can be selected.
static int SINGLE_SELECT
          Constant indicating that only one value can be selected.
 
Method Summary
 void addValue(Object value)
          Appends the specified value to the end of this list of values for the property.
 void addValue(Object value, int index)
          Inserts the specified value at the specified position in this properties list of values.
 void addValueAsString(String value)
          Adds a value to the current set of values for the property.
 void addValueAsString(String value, int index)
          Adds a value to the current set of values for the property.
 boolean allowDuplicateValues()
          Returns boolean indicating if duplicate values are allowed.
 Object get(int index)
          Returns the value at the specified position in this property.
 int getSelectionStyle()
          Returns one of the enumerated selection constants: SINGLE_SELECT, or MULTI_SELECT.
 Object[] getValues()
          Returns the current set of values for the property.
 String[] getValuesAsStrings()
          Returns the current set of values for the property as String values.
 Object removeValue(int index)
          Removes the element at the specified position in this list (optional operation).
 boolean removeValue(Object value)
          Removes the first occurrence in this property of the specified value.
 boolean removeValueAsString(String value)
          Removes a value from the current set of values for the property.The string value used must be semantically equivalent to the complete object instance it represents.
 void setSelection(int[] indices)
          Sets the currently selected values in this property.
 
Methods inherited from interface commonj.connector.metadata.discovery.properties.SingleTypedProperty
getPropertyType
 
Methods inherited from interface commonj.connector.metadata.discovery.properties.Property
getValidationMessage, isSet, isValid, unSet
 
Methods inherited from interface commonj.connector.metadata.discovery.properties.PropertyDescriptor
addPropertyChangeListener, clone, getDescription, getDisplayName, getID, getName, isEnabled, removePropertyChangeListener
 

Field Detail

SINGLE_SELECT

static final int SINGLE_SELECT
Constant indicating that only one value can be selected.

See Also:
Constant Field Values

MULTI_SELECT

static final int MULTI_SELECT
Constant indicating many values can be selected.

See Also:
Constant Field Values
Method Detail

getValues

Object[] getValues()
Returns the current set of values for the property.

Returns:
Object[] An non null array of the current set of values for the property. If the property has no values set then the array must be of length zero.

addValue

void addValue(Object value)
              throws MetadataException
Appends the specified value to the end of this list of values for the property.

Parameters:
value - - the value to add.
Throws:
MetadataException - - thrown if an error occurs or if the addition was refused. Properties may place limitations on what values may be added to them. In particular, some properties will refuse to add null values, while others will impose restrictions on the type of values that may be added. A MetadataException must always be thrown in cases where the value addition was refused. Ideally, the message field of the MetadataException would indicate the reason for refusal.

addValue

void addValue(Object value,
              int index)
              throws MetadataException,
                     IndexOutOfBoundsException
Inserts the specified value at the specified position in this properties list of values. Shifts the value currently at that position (if any) and any subsequent values by adding one to their indices.

Parameters:
value - - the value to add.
index - index at which the specified value is to be inserted.
Throws:
IndexOutOfBoundsException - if the index is out of range
MetadataException - - thrown if an error occurs or if the addition was refused. Properties may place limitations on what values may be added to them. In particular, some properties will refuse to add null values, while others will impose restrictions on the type of values that may be added. A MetadataException must always be thrown in cases where the value addition was refused. Ideally, the message field of the MetadataException would indicate the reason for refusal.

removeValue

boolean removeValue(Object value)
Removes the first occurrence in this property of the specified value. If this property does not contain the value, it is unchanged. More formally, removes the value with the lowest index i such that (value==null ? get(i)==null : o.equals(get(i))) (if such an element exists).

Parameters:
value - - the value to remove.
Returns:
boolean - a flag indicating whether or not the remove was successful.

removeValue

Object removeValue(int index)
Removes the element at the specified position in this list (optional operation). Shifts any subsequent elements to the left (subtracts one from their indices). Returns the element that was removed from the list.

Parameters:
index -
Returns:
the value previously at the specified position or null if none existed.

getValuesAsStrings

String[] getValuesAsStrings()
Returns the current set of values for the property as String values. The string values returned must be semantically equivalent as the complete object instance they represent. In other words, the object instance, and its state, must be recreateable using the string value.

Returns:
String[] An non null String array of the current set of values for the property. If the property has no values set then the array must be of length zero.

addValueAsString

void addValueAsString(String value)
                      throws MetadataException
Adds a value to the current set of values for the property. The string value used must be semantically equivalent to the complete object instance it represents. In other words, the object instance, and its state, must be recreateable using the string value. The behavior of this method is identical to the addValue(Object)method.

Parameters:
value - - the value to add.
Throws:
MetadataException - - thrown if an error occurs or if the addition was refused. Properties may place limitations on what values may be added to them. In particular, some properties will refuse to add null values, while others will impose restrictions on the type of values that may be added. A MetadataException must always be thrown in cases where the value addition was refused. Ideally, the message field of the MetadataException would indicate the reason for refusal.
See Also:
addValue(Object)

addValueAsString

void addValueAsString(String value,
                      int index)
                      throws MetadataException,
                             IndexOutOfBoundsException
Adds a value to the current set of values for the property. The string value used must be semantically equivalent to the complete object instance it represents. In other words, the object instance, and its state, must be recreateable using the string value. The behavior of this method is identical to the addValue(Object, int) method.

Parameters:
value - - the value to add.
index - index at which the specified value is to be inserted.
Throws:
IndexOutOfBoundsException - if the index is out of range
MetadataException - thrown if an error occurs or if the addition was refused. Properties may place limitations on what values may be added to them. In particular, some properties will refuse to add null values, while others will impose restrictions on the type of values that may be added. A MetadataException must always be thrown in cases where the value addition was refused. Idealy, the message field of the MetadataException would indicate the reason for refusal.
See Also:
addValue(Object, int)

removeValueAsString

boolean removeValueAsString(String value)
Removes a value from the current set of values for the property.The string value used must be semantically equivalent to the complete object instance it represents. In other words, the object instance, and its state, must be recreateable using the string value. The behavior of this method is identical to the removeValue(Object)method.

Parameters:
value - - the value to remove.
Returns:
boolean - a flag indicating whether or not the remove was successful.
See Also:
removeValue(Object)

get

Object get(int index)
           throws IndexOutOfBoundsException
Returns the value at the specified position in this property.

Parameters:
index - index of element to return.
Returns:
the element at the specified position in this property.
Throws:
IndexOutOfBoundsException - if the index is out of range

setSelection

void setSelection(int[] indices)
Sets the currently selected values in this property.

Parameters:
indices - of currently selected values.
Since:
1.1

allowDuplicateValues

boolean allowDuplicateValues()
Returns boolean indicating if duplicate values are allowed.

Returns:
true if duplicate values are allowed, and false if duplicate values are not allowed.
Since:
1.1

getSelectionStyle

int getSelectionStyle()
Returns one of the enumerated selection constants: SINGLE_SELECT, or MULTI_SELECT. This is used by tool environments to determine the selection behaviour to permit when displaying the values to users.

This is used with setSelection(int[]) and PropertyEvent.MULTI_VALUED_PROPERTY_SELECTION. Listeners will know whether they need to support a selection with one or more values.

Returns:
Returns one of the enumerated selection constants. The default is MULTI_SELECT.
Since:
1.1