setAttrValue()

Sets the value of an attribute.

Syntax

public void setAttrValue(String attrName, Object newval);
  
 public void setAttrValue(int position, Object newval);
 

Parameters

attrName
Is the name of the attribute whose value you want to set.
position
Is an integer that specifies the ordinal position of the attribute in the business object's attribute list.
newval
Is the value to set in the business object.

Return values

None.

Exceptions

CxObjectNoSuchAttributeException
Thrown if the position or name specified is not valid for the definition of this business object.
CxObjectInvalidAttrException
Thrown if the value passed in is not a valid value for the particular attribute.

Notes

You can use the name or position method to set an attribute value.

The setAttrValue() method sets the value of an attribute to the value passed in as a parameter to the method. This value can be of any type supported by the IBM WebSphere business integration system. If the attribute type is a type other than container and subobject type, then the passed-in parameter is of type String. For subobjects, the passed-in parameter is of type BusinessObjectInterface. For containers, the passed-in parameter can be either of type CxObjectContainerInterface or BusinessObjectInterface.

This method can be called directly on a container attribute with an instance of type BusinessObjectInterface. When this is the first business object that this container holds, a container will be created internally and this business object is inserted into that new container. Subsequent similar calls add business objects to the same container. Alternatively, you can create a container of type CxObjectContainerInterface by using the JavaConnectorUtil.createContainer() method, then inserting all business objects into this container and invoking setAttrValue() with the container as the parameter.

See also

See also the description of the getDefaultAttrValues() method.

Copyright IBM Corp. 1997, 2003