Set a business object's attribute to a specified value of a particular data type.
Syntax
void set(String attribute, Object value) void set(int position, Object value)
void set(String attribute, boolean value) void set(String attribute, double value) void set(String attribute, float value) void set(String attribute, int value) void set(String attribute, long value) void set(String attribute, Object value) void set(String attribute, String value)
Parameters
Exceptions
CollaborationException--The set() method can set the following exception type for this exception:
Notes
These set() methods set an attribute value in the current business object. These methods set an object reference when it assigns the value to the attribute. It does not clone the attribute value from the source business object. Therefore, any changes to value in the source business object are also made to the attribute in the business object that calls set().
The set() method provides the following forms:
These methods provide the ability to access an attribute value by specifying the name of the attribute.
This form of the set() method provides the ability to access an attribute value by specifying either the name of the attribute or the attribute's index position within the business object attribute list.
Examples
The following example sets the LName attribute in toCustomer to the value Smith.
toCustomer.set("LName", "Smith");
The following example illustrates how set() assigns an object reference instead of cloning the value:
BusObj BusObj myBusObj = new BusObj(); BusObj mySettingBusObj = new BusObj(); myBusObj.set("attr1", mySettingBusObj);
After this code fragment executes, the attr1 attribute of myBusObj is set to the mySettingBusObj business object. If mySettingBusObj is changed in any way, myBusObj.attr1 is changed in the exact manner because set() makes an object reference to mySettingBusObj when it sets the attr1 attribute; it does not create a static copy of mySettingBusObj.
The following example sets an attribute value using the attribute's ordinal position within the attribute list:
for(i=0; i<maxAttrCount; i++) { myBusObj.set(i, strValue); ...