Java Reference
In-Depth Information
addString : Adds a new String field datum
addBoolean : Adds a new boolean field datum
addStringArray : Adds a new field datum consisting of an array of String s
All of these methods take the field, attributes, and field datum you want to add to an
existing field.
The following setter methods are available:
setBinary : Sets the value of a binary field
setDate : Sets the value of a Date field
setInt : Sets the value of an integer field
setString : Sets the value of a String field
setBoolean : Sets the value of a boolean field
setStringArray : Sets the value of a field consisting of an array of String s
When you invoke one of these methods, you pass the field you wish to add or
replace, the index, any attributes of the item, and the data to set.
Once you finish changing a PIMItem , you must invoke its commit method to write the
changes back to the PIM package's record store.
Adding a PIM Record
Adding a new record is a three-step process:
1. Call the factory method in the PIMList interface subclass to create an empty record
of the desired type.
2. Invoke the various adder methods on the new record to populate it with the data.
3. Call commit to flush your changes to the PIM package's record store.
The PIMList subclasses each define a factory method ( createContact , createEvent ,
or createToDo ), which you must use to create an empty record in the application's record
store. Once you do, you can fill out the fields of the resulting record and then simply flush
it to the store. Listing 7-7 shows how to create a new contact (omitting the obligatory
exception handling).
 
Search WWH ::




Custom Search