IBM WebSphere Application ServerTM
Release 8

com.ibm.wbiserver.brules.mgmt
Interface PropertyList

All Superinterfaces:
BusinessRuleChangeDetector, java.lang.Iterable<Property>, java.io.Serializable

public interface PropertyList
extends BusinessRuleChangeDetector, java.io.Serializable, java.lang.Iterable<Property>

This interface represents a list of properties. Specific methods are provided for getting an iterator over the list, to get the element at a specified index, and to add and remove elements from the list. In order to change an existing Property in the list, obtain the Property that you want to change using either an iterator or the get method and then simply use set methods to change the object. Note that only UserDefinedProperty objects are changeable so you must check the subclass of the Property object before you can change it.

This class also has methods to create a new UserDefinedProperty object.


Field Summary
static java.lang.String COPYRIGHT
           
 
Method Summary
 void addProperty(UserDefinedProperty newProperty)
          Add the specified property to the list.
 Property get(int index)
          Get the property at the specified index in the list.
 Property getByName(java.lang.String propertyName)
          Get the property with the specified name from the list.
 boolean isEmpty()
          Determine whether or not this list is empty.
 java.util.Iterator<Property> iterator()
          Get an iterator over this list.
 UserDefinedProperty newUserDefinedProperty(java.lang.String name, java.lang.String value)
          Create a new UserDefinedProperty object with the specified name and value.
 boolean removeProperty(UserDefinedProperty property)
          Remove the specified user-defined property from the list.
 UserDefinedProperty removePropertyByName(java.lang.String propertyName)
          Remove the user-defined property with the specified name from the list.
 void setPropertyValue(java.lang.String name, java.lang.String value)
          Set the value of the property with the specified name to the specified value.
 int size()
          Get the number of properties in this list.
 
Methods inherited from interface com.ibm.wbiserver.brules.mgmt.BusinessRuleChangeDetector
hasChanges
 

Field Detail

COPYRIGHT

static final java.lang.String COPYRIGHT
See Also:
Constant Field Values
Method Detail

iterator

java.util.Iterator<Property> iterator()
Get an iterator over this list. The iterator returned does not support making changes to the underlying list, i.e. it does not support the remove method of the Iterator interface. If that method is called, an UnsupportedOperationException is thrown.

In order to add or remove elements from the list, the addProperty or removeProperty methods should be used. These two methods synchronize on this PropertyList object. If the client code is multi-threaded, then the client should synchronize on the PropertyList object while using the iterator.

Specified by:
iterator in interface java.lang.Iterable<Property>
Returns:
An iterator over the underlying list that does not support modifications.

get

Property get(int index)
Get the property at the specified index in the list.

Parameters:
index - The index of the property to be returned. The first element in the list is at index 0.
Returns:
The Property object at the specified index.
Throws:
java.lang.IndexOutOfBoundsException - if the index is out of range.

getByName

Property getByName(java.lang.String propertyName)
Get the property with the specified name from the list. If there is no property with the specified name in this list, null is returned.

Parameters:
propertyName - The name of the property to retrieve. Must not be null.
Returns:
The Property object from this list with the specified name. null if no such Property exists.
Throws:
java.lang.IllegalArgumentException - if the propertyName argument is null.

newUserDefinedProperty

UserDefinedProperty newUserDefinedProperty(java.lang.String name,
                                           java.lang.String value)
Create a new UserDefinedProperty object with the specified name and value. No validation is performed on either the name or the value. The name will be validated when the user-defined property is added to a PropertyList to ensure that it is unique in that list. The value is completely defined by the user and hence is never validated by the API.

Parameters:
name - The name of the new user-defined property. Must not be null and must contain at least one non-whitespace character.
value - The value for the new user-defined property. Must not be null.
Returns:
A new UserDefinedProperty object with the specified name and value.
Throws:
java.lang.IllegalArgumentException - if name is null or does not contain at least one non-whitespace character, or if value is null.

addProperty

void addProperty(UserDefinedProperty newProperty)
                 throws ValidationException
Add the specified property to the list. This method synchronizes on the object on which it is called. Clients using an iterator to iterate over the list should also synchronize on this object to ensure thread safety.

Note: this method is not intended to change the value of an existing property. To change the value of an existing property, simply get the Property object that you want to change and use its set methods.

Parameters:
newProperty - The Property object to be added to the list. A new UserDefinedProperty object can be created using the newUserDefinedProperty method on this interface.
Throws:
ValidationException - if there is already a property with the specified name in this list.
java.lang.IllegalArgumentException - if newProperty is null.

removeProperty

boolean removeProperty(UserDefinedProperty property)
Remove the specified user-defined property from the list. If the specified user-defined property does not exist in the list, then no action is taken and the list remains unchanged.

This method synchronizes on the object on which it is called. Clients using an iterator to iterate over the list should also synchronize on this object to ensure thread-safety.

Parameters:
property - The UserDefinedProperty to be removed. Must not be null.
Returns:
true if the PropertyList contained the specified property. Otherwise false.

removePropertyByName

UserDefinedProperty removePropertyByName(java.lang.String propertyName)
Remove the user-defined property with the specified name from the list. If no user-defined property exists with the specified name, then no action is taken and the list remains unchanged.

This method synchronizes on the object on which it is called. Clients using an iterator to iterate over the list should also synchronize on this object to ensure thread-safety.

Parameters:
propertyName - The name of the user-defined property to be removed. Must not be null.
Returns:
The UserDefinedProperty object that was removed from the list. If no UserDefinedProperty was found with the specified name, then null is return.

setPropertyValue

void setPropertyValue(java.lang.String name,
                      java.lang.String value)
Set the value of the property with the specified name to the specified value. If a user-defined property with the specified name already exists, then its value is changed to the specified value. If no property exists with the specified name, then a new property is defined with the specified name and value. If the specified value is null and the property is currently defined, then the property will be removed from this business rule group. If the specified value is null and the property is not currently defined, then no action is taken. If a system-defined property exists with the specified name, then a SystemPropertyNotChangeableException is thrown.

This method synchronizes on the object on which it is called. Clients using an iterator to iterate over the list should also synchronize on this object to ensure thread-safety.

Parameters:
name - The name of the property whose value is to be set. Must not be null or the zero-length string.
value - The value that the property should be set to. May be null.
Throws:
java.lang.IllegalArgumentException - if the name parameter is null or is the zero-length string.
SystemPropertyNotChangeableException - if a property with the specified name already exists and it is system-defined.

size

int size()
Get the number of properties in this list.

Returns:
The number of properties in this list.

isEmpty

boolean isEmpty()
Determine whether or not this list is empty.

Returns:
true if this list is empty; otherwise false.

IBM WebSphere Application ServerTM
Release 8