copy()

Copy all attributes values from the input business object to this one.

Syntax

void copy(BusObj inputBusObj)
 

Parameters

inputBusObj
The name of the business object whose attributes values are copied into the current business object.

Notes

The copy() method copies the entire business object, including all child business objects and child business object arrays. This method does not set a reference to the copied object. Instead, it clones all attributes; that is, it creates separate copies of the attributes.

Examples

The following example copies the values contained in sourceCustomer to destCustomer.

destCustomer.copy(sourceCustomer);
 

The following example creates three business objects (myBusObj, myBusObj2, and mysettingBusObj) and sets the attr1 attribute of myBusObj with the value in mysettingBusObj. It then clones all attributes of myBusObj to myBusObj2.

BusObj myBusObj = new BusObj();
 BusObj myBusObj2 = new BusObj();
  
 BusObj mySettingBusObj = new BusObj();
  
 myBusObj.set("attr1", mySettingBusObj);
 myBusObj2.copy(myBusObj);
 

After this code fragment executes, myBusObj.attr1 and myBusObj2.attr1 are both set to the mySettingBusObj business object. However, if mySettingBusObj is changed in any way, myBusObj.attr1 changes but myBusObj2.attr1 does not. Because the attributes of myBusObj2 were set with copy(), their values were cloned. Therefore, the value of attr1 in myBusObj2 is still the original mySettingBusObj.attr1 value before the change.

Copyright IBM Corp. 2003, 2004