|
|
The Attribute ObjectAn attribute object is usually contained in Entry objects. An attribute is a named object with associated values. Each value in the attribute corresponds to a Java object of some type. Attribute names are case insensitive and can not contain slash ('/') as part of it's name. Remember that some of the Connectors (for example those accessing a database) might consider other characters as unsuited: If you can, try to stick to alpha-numeric character in attribute names. If the Attribute was populated with Connector values by the attribute map, the values will of the same data-type that the Connector supplied. Check the javadocs for a full description of the Attribute Object Methods
ExamplesCreating a new Attribute objectvar attr = system.newAttribute("AttributeName"); This example will create an Attribute object with name "AttributeName" and assign it to the attr variable. Note that upon initial creation, the attribute holds no value. Now, through the attr variable you can access and interact with the newly created attribute. Adding values to an Attribute attr.addValue("value
1"); This example adds the string values "value 1" and "value 2" to the attr Attribute, thereby creating a multiple values attribute. Consecutive calls to addValue(obj) add values in the same order in the attribute. Scanning Attribute's values
var values = attr.getValues(); This example will process any attribute object, whether it holds single or multiple values. In reality, there is no difference between single and multiple value attributes. Every attribute may hold zero, one or more values - a single value attribute is therefore merely an "underloaded" multiple values attribute. See Also
|
|
|