Joltsessionattributes class – HP NonStop G-Series User Manual
Page 97

always at position zero. For example, if you have a list of account numbers and you use a delete method, the item at
position zero is deleted. For example:
delete ( "ACCTNUM")
Deletes the account number at position zero of the account number list.
setInt ( "ACCTNUM", 3200)
Sets the account number at position zero to the value 3200.
Changing Items by Item Position
The following types of methods in the Jolt Class Library are position dependent. To change a position-dependent item,
you specify the location or index of the item in a list.
set...Item methods
●
deleteItem methods
●
For example, to set the third item in a list of account numbers to a value, you would specify the following:
setIntItem ("ACCTID", 2, 5000)
The example sets the account number at position three to the value 5000. You specify an index of 2 because the index
numbering starts at 0 and 2 is at the third position of the list.
To delete the first item in a list of account numbers, you would specify the following:
deleteItem ("ACCTID", 0)
The example deletes the account number at position 0 and is exactly equivalent to using just the delete method. A
set...Item (name, 0, value) also works exactly as the set method.
Getting Items
The Jolt Class Library includes a number of get methods. However, the get methods operate differently from the other
types of methods. The following three get methods retrieve information with a single value.
getOccurrenceCount
●
getName
●
getApplicationcode
●
All other get methods are in the form of a get...Def or get...ItemDef. The get...Def methods retrieve information about the
first item (item 0). The get...ItemDef methods retrieve information about an item that you specify by its position or index
number. If the item has no information, these methods allow you to set a default. For example:
getIntItemDef ("CreditRating", 4, -1)
The example gets the credit rating for the fifth item in a list of items starting at position zero. If the item has no value for a
credit rating, the get returns the default value of -1. You specify the value for the method in the defValue parameter.
Appending Items
The add methods append an item to the end of a list of items. Of course if your list of items is empty, an add will make
the item the first one in the list. In the following example, the add method appends a name to the end of a list of names:
addString ("CompanyName", "BoltBikeWorks")
JoltSessionAttributes Class
java.lang.Object
|
+----bea.jolt.JoltSessionAttributes