|
PIM Optional Package 1.0 Final Release |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
Represents the common interfaces of an item for a PIM list. A PIM item represents a collection of data for a single PIM entry. A PIM item is created from a particular PIM list and is associated with that list for the life of the item. PIM items can have its data imported and exported using standard byte based formats. Each implementing class defines what formats can be imported and exported for that item.
PIMItems reference its data through fields. A field is a grouping of data
values that all have similar characteristics. An example of a field is TEL,
which indicates data values for that particular field are telephone numbers.
Classes implementing the PIMItem interface defines the possible fields that for
that specific class (e.g TEL is defined in the Contact
interface
as a field that a contact may support).
PIM implementations are not required to support all of the possible fields
defined in the classes implementing the PIMItem interface. This is because no
native PIM databases contain all of the fields defined in this API. The PIMList
that a PIMItem belongs to determines what fields a PIMItem can support and
store (all PIMItems in a particular PIMList support the same set of fields).
The PIMList.getSupportedFields()
method from a particular PIMItem's PIMList is used to find out what fields are
supported within this item. Since not all possible fields are actually
supported in a particular PIMItem, all fields should be checked for support in
the item's PIMList using
PIMList.isSupportedField(int)
prior to being used in any
retrieval or storage method.
Each field has the following pieces of information available for it:
A single field can have zero or more data values associated with it at any instance. All values within a field have the same data type as dictated by the field (for example, all Contact.TEL field data values must be of STRING type). The data type of a field determines the add/get/set methods to use for accessing the data values (for example, if a field requires STRING data types, then addString, getString, and setString methods are used to access the data).
Data values within a field are treated as a variable-length array of values,
very similar to the behavior of a Vector
. As such, the following
rules apply for accessing data values for fields:
Vector.addElement
.
Vector.elementAt()
.
removeValue(int, int)
. All indexes in the field's array
are guaranteed by the implementation to contain an assigned value. Therefore,
removing fields from the middle of a field's array causes compacting of the
array and reindexing of the data values. This is similar behavior to the method
Vector.removeElement(Object)
.Each field has a human readable label, usually used for display purposes.
The label can be retrieved through
PIMList.getFieldLabel(int)
.
The data values for a field has a data type, such as
INT
,
BINARY
,
BOOLEAN
,
DATE
,
STRING_ARRAY
or
STRING
. The data type of the field's data can be retrieved
through
PIMList.getFieldDataType(int)
. All data values for a
particular field have the same data type.
Fields can be classified into two logical divisions: standard fields and extended fields. This division of fields generally determines the portability of the fields across implementations. Standard fields are specifically defined within the javax.microedition.pim package and may be available on almost all PIM implementations. Extended fields are platform specific fields defined by an individual implementation and are therefore generally not portable across different devices. Extended fields are generally defined in vendor specific classes derived from this class.
Standard fields are fields that have IDs explicitly defined as part of the PIM APIs in the javax.microedition.pim package. These fields are the common fields among PIM lists and are more likely to be portable across PIM implementations (but not guaranteed since not all platforms support the same fields in a PIMItem).
Extended fields are fields that do not have a specific field explicitly defined
in the javax.microedition.pim package, but are defined in vendor-specific
classes in a separate vendor package. These fields may or may not be exposed
publicly in vendor specific classes. Vendors are allowed to extend the field
set for any of the PIM items in this manner to address any platform specific
fields they wish to support. Users can find out if a field is an extended field
by comparing its value against
EXTENDED_FIELD_MIN_VALUE
, find out the field's allowed
data type through the method
PIMList.getFieldDataType(int)
, and find out the field's
label through the methodPIMList.getFieldLabel(int)
.
Optional attributes can be provided to further describe individual data values
for a field. Attributes are specified when adding data values to a field. These
attributes are hints to the underlying implementation providing more
information about the data value than just a field can provide. Since they are
hints, they may or may not be ignored by the implementation when adding the
data values. The actual attributes used and associated with the data values
after adding can be retrieved by the method
getAttributes(int, int)
. Attributes can also have human
readable labels associated with them, retrieved by the method
PIMList.getAttributeLabel(int)
. If no attributes are to be
associated with a data value, then
ATTR_NONE
must be used.
Attributes are handled in the API using a single bit to indicate a specific
attribute and using int values as bit arrays to indicate a set of attributes.
int values can be checked to see if they contain a specific attribute by using
bitwise AND (&) with the attribute and the int value.
ATTR_NONE
is a special attribute that indicates no
attributes are set and has a value of 0 that erases all other attributes
previously set.
Optional attributes may also be extended by vendors and their PIM API
implementations. These extended attributes also may or may not be exposed
publicly in vendor specific classes. The label for these attributes can be
retrieved through
PIMList.getAttributeLabel(int)
.
Categories are string items assigned to an item to represent the item's inclusion in a logical grouping. The category string correspond to category values already existing in the PIMItem's associated PIMList. Category support per list is optional, depending on the implementing PIMList class that the item is associated with. The item's list determines if categories can be assigned, and how many categories can be assigned per item.
Field Summary | |
static int |
ATTR_NONE
Constant indicating that no additional attributes are applicable to a data value for a field. |
static int |
BINARY
Data type indicating data is binary in a byte array. |
static int |
BOOLEAN
Data type indicating data is of boolean primitive data type. |
static int |
DATE
Data type indicating data is a Date in long primitive data type format expressed in the same long value format as java.util.Date, which is milliseconds since the epoch (00:00:00 GMT, January 1, 1970). |
static int |
EXTENDED_ATTRIBUTE_MIN_VALUE
Constant indicating the minimum possible value for an extended attribute constant. |
static int |
EXTENDED_FIELD_MIN_VALUE
Constant indicating the minimum possible value for an extended field constant. |
static int |
INT
Data type indicating data is of int primitive data type. |
static int |
STRING
Data type indicating data is a String object. |
static int |
STRING_ARRAY
Data type indicating data is a array of related fields returned in a string array. |
Method Summary | |
void |
addBinary(int field,
int attributes, byte[] value, int offset, int length)
Adds a binary data value to a field in the item. |
void |
addBoolean(int field,
int attributes, boolean value)
Adds a boolean value to a field in the item. |
void |
addDate(int field,
int attributes, long value)
Adds a date value to a field in the item. |
void |
addInt(int field,
int attributes, int value)
Adds an integer value to a field in the item. |
void |
addString(int field,
int attributes, java.lang.String value)
Adds a String value to a field in the item. |
void |
addStringArray(int field,
int attributes, java.lang.String[] value)
Adds an array of related string values as a single entity to a field in the item. |
void |
addToCategory(java.lang.String category)
Adds a category to this item. |
void |
commit()
This method persists the data in the item to its PIM list. |
int |
countValues(int field)
Returns the number of data values currently set in a particular field. |
int |
getAttributes(int field,
int index)
Gets the actual attributes associated with the data value at the given index for the indicated field. |
byte[] |
getBinary(int field,
int index)
Get a binary data value for a field from the item. |
boolean |
getBoolean(int field,
int index)
Get a boolean value from a field in the item. |
java.lang.String[] |
getCategories()
Returns all the categories for that the item belongs to. |
long |
getDate(int field,
int index)
Get a date value from a field in the item. |
int[] |
getFields()
Returns all fields in the item that have data stored for them. |
int |
getInt(int field,
int index)
Get an integer value from a field in the item. |
PIMList |
getPIMList()
Returns the PIMList associated with this item. |
java.lang.String |
getString(int field,
int index)
Get a String value from a field in the item. |
java.lang.String[] |
getStringArray(int field,
int index)
Get an array of related values from a field in the item. |
boolean |
isModified()
This method returns a boolean indicating whether any of this item's fields have been modified since the item was retrieved or last committed. |
int |
maxCategories()
Returns the maximum number of categories that this item can be assigned to. |
void |
removeFromCategory(java.lang.String category)
Remove a category from this item. |
void |
removeValue(int field,
int index)
Removes the value at the given index for the indicated field in this item. |
void |
setBinary(int field,
int index, int attributes, byte[] value, int offset,
int length)
Sets an existing binary data value in a field to a new value. |
void |
setBoolean(int field,
int index, int attributes, boolean value)
Sets an existing boolean data value in a field to a new value. |
void |
setDate(int field,
int index, int attributes, long value)
Sets an existing date data value in a field to a new value. |
void |
setInt(int field,
int index, int attributes, int value)
Sets an existing int data value in a field to a new value. |
void |
setString(int field,
int index, int attributes, java.lang.String value)
Sets an existing String data value in a field to a new value. |
void |
setStringArray(int field,
int index, int attributes, java.lang.String[] value)
Sets an existing String array data value in a field to a new value. |
Field Detail |
public static final int BINARY
BINARY
is retrieved via
getBinary(int, int)
and added via
addBinary(int, int, byte[], int, int)
.
public static final int BOOLEAN
BOOLEAN
is retrieved via
getBoolean(int, int)
and added via
addBoolean(int, int, boolean)
.
public static final int DATE
DATE
is retrieved via
getDate(int, int)
and added via
addDate(int, int, long)
.
public static final int INT
INT
is retrieved via
getInt(int, int)
and added via
addInt(int, int, int)
.
public static final int STRING
STRING
is retrieved via
getString(int, int)
and added via
addString(int, int, java.lang.String)
.
public static final int STRING_ARRAY
STRING_ARRAY
is retrieved via
getStringArray(int, int)
and added via
addStringArray(int, int, java.lang.String[])
.
public static final int ATTR_NONE
public static final int EXTENDED_FIELD_MIN_VALUE
public static final int EXTENDED_ATTRIBUTE_MIN_VALUE
Method Detail |
public PIMList getPIMList()
null
is returned.public void commit() throws PIMException
Some devices may not allow categories in the item to be persisted which are not
in the list returned from
PIMList.getCategories()
. In this case the categories are
dropped silently when this method is invoked (this allows data imported using
PIM.fromSerialFormat(java.io.InputStream, java.lang.String)
to be persisted).
Also note that some field values may be altered during the commit to fit platform restrictions. A common example of this is Date fields. If a platform does not support storing its Date values with millisecond granularity, the platform rounds down the given Date value to its nearest value supported by the platform.
PIMException
- if the commit encounters an error and cannot complete. Also thrown if the
item does not belong to any list, or the list is closed or inaccessible.
java.lang.SecurityException
- if the application has not been
granted write access to the PIM list or the list is opened READ_ONLY.public boolean isModified()
public int[] getFields()
public byte[] getBinary(int field, int index)
PIMList.isSupportedField(int)
should be used to verify the
field validity for this item prior to invoking this method.
field
- The field from which the data is
retrieved.index
- an index to a particular value associated with
the field. java.lang.IllegalArgumentException
- if the field is not valid for
the implementing class.
java.lang.IndexOutOfBoundsException
- if the index is negative or
greater than or equal to the number of values currently contained in the field.
UnsupportedFieldException
- if the field is not supported in the implementing instance of the class.public void addBinary(int field, int attributes, byte[] value, int offset, int length)
Vector.addElement
.
PIMList.isSupportedField(int)
should be used to verify the field validity for this item prior to invoking
this method.
field
- The field to which the value belongs.attributes
- a bit array specifying any optional attributes describing this value. These
attributes are a hint to the about the value's characteristics and some or all
may be ignored by this method due to platform restrictions. Attributes that are
invalid or not applicable are also ignored.value
- The data to add
to the field. The data is an inline binary data representation and must be in a
"B" binary encoded string as defined by [IETF RFC 2047].offset
-
int indicating the offset into the provided byte array from where to start
reading the binary data.length
- int indicating the number of
bytes to read from starting from the offset in the byte array. If the number of
bytes available from the array are less than the length, only the remaining
bytes are provided and the field's resulting binary data length is value.length
- offset
. java.lang.IllegalArgumentException
- if the field is not valid for
the implementing class, the field does not have a data type of BINARY
,
offset is negative, offset is greater than or equal to the length of the value
byte array, length is zero or negative, or the value array is length 0.
java.lang.NullPointerException
- if value
is null
.
UnsupportedFieldException
- if the field is not supported in the implementing instance of the class.
FieldFullException
- if the field already contains the maximum number of data values it can hold.public void setBinary(int field, int index, int attributes, byte[] value, int offset, int length)
Vector.setElementAt
. This
method cannot be used to add new values to a field; use
addBinary(int, int, byte[], int, int)
.
PIMList.isSupportedField(int)
should be used to verify the
field validity for this item prior to invoking this method.
field
- The field to which the value belongs.index
- an index to a particular value associated with the field.attributes
- a bit array specifying any optional attributes describing this value. These
attributes are a hint to the about the value's characteristics and some or all
may be ignored by this method due to platform restrictions. Attributes that are
invalid or not applicable are also ignored.value
- The new value
of the data at the field's index. The data is an inline binary data
representation and must be in a "B" binary encoded string as defined by [IETF
RFC 2047].offset
- int indicating the offset into the provided
byte array from where to start reading the binary data.length
-
int indicating the number of bytes to read starting from the offset in the byte
array. If the number of bytes available from the array are less than the
length, only the remaining bytes are provided and the field's resulting binary
data length is value.length - offset
. java.lang.IllegalArgumentException
- if the field is not valid for
the implementing class, if offset
is negative, length
is less than or equal to zero, or value
is zero length.
java.lang.NullPointerException
- if value
is null
.
UnsupportedFieldException
- if the field is not supported in the implementing instance of the class.
java.lang.IndexOutOfBoundsException
- if the index is negative or
greater than or equal to the number of values currently contained in the field.public long getDate(int field, int index)
PIMList.isSupportedField(int)
should be used to verify the
field validity for this item prior to invoking this method.
field
- The field from which the data is
retrieved.index
- an index to a particular value associated with
the field. java.lang.IllegalArgumentException
- if the field is not valid for
the implementing class.
java.lang.IndexOutOfBoundsException
- if the index is negative or
greater than or equal to the number of values currently contained in the field.
UnsupportedFieldException
- if the field is not supported in the implementing instance of the class.public void addDate(int field, int attributes, long value)
Vector.addElement
.
PIMList.isSupportedField(int)
should be used to verify the
field validity for this item prior to invoking this method.
Note that the value provided may be rounded-down by an implementation due to platform restrictions. For example, should a native PIM database on support date values with granularity in terms of seconds, then the provided date value is rounded down to the nearest second.
field
- The field to which the value belongs.attributes
- a bit array specifying any optional attributes describing this value. These
attributes are a hint to the about the value's characteristics and some or all
may be ignored by this method due to platform restrictions. Attributes that are
invalid or not applicable are also ignored.value
- The data to add
to the field. The date must be expressed in the same long value format as
java.util.Date, which is milliseconds since the epoch (00:00:00 GMT, January 1,
1970). java.lang.IllegalArgumentException
- if the field is not valid for
the implementing class or the field does not have a data type of DATE
.
UnsupportedFieldException
- if the field is not supported in the implementing instance of the class.
FieldFullException
- if the field already contains the maximum number of data values it can hold.public void setDate(int field, int index, int attributes, long value)
Vector.setElementAt
. This
method cannot be used to add new values to a field; use
addDate(int, int, long)
.
PIMList.isSupportedField(int)
should be used to verify the
field validity for this item prior to invoking this method.
Note that the value provided may be rounded-down by an implementation due to platform restrictions. For example, should a native PIM database only support date values with granularity in terms of seconds, then the provided date value is rounded down to the nearest second.
field
- The field to which the value belongs.index
- an index to a particular value associated with the field.attributes
- a bit array specifying any optional attributes describing this value. These
attributes are a hint to the about the value's characteristics and some or all
may be ignored by this method due to platform restrictions. Attributes that are
invalid or not applicable are also ignored.value
- The new value
of the data at the field's index. The date must be expressed in the same long
value format as java.util.Date, which is milliseconds since the epoch (00:00:00
GMT, January 1, 1970). java.lang.IllegalArgumentException
- if the field is not valid for
the implementing class, or the field cannot be set to the value provided (e.g.
the value is not valid for that field or this field's value is read-only).
UnsupportedFieldException
- if the field is not supported in the implementing instance of the class.
java.lang.IndexOutOfBoundsException
- if the index is negative or
greater than or equal to the number of values currently contained in the field.public int getInt(int field, int index)
PIMList.isSupportedField(int)
should be used to verify the
field validity for this item prior to invoking this method.
field
- The field from which the data is
retrieved.index
- an index to a particular value associated with
the field. java.lang.IllegalArgumentException
- if the field is not valid for
the implementing class.
java.lang.IndexOutOfBoundsException
- if the index is negative or
greater than or equal to the number of values currently contained in the field.
UnsupportedFieldException
- if the field is not supported in the implementing instance of the class.public void addInt(int field, int attributes, int value)
Vector.addElement
.
PIMList.isSupportedField(int)
should be used to verify the
field validity for this item prior to invoking this method.
field
- The field to which the value belongs.attributes
- a bit array specifying any optional attributes describing this value. These
attributes are a hint to the about the value's characteristics and some or all
may be ignored by this method due to platform restrictions. Attributes that are
invalid or not applicable are also ignored.value
- The data to add
to the field. java.lang.IllegalArgumentException
- if the field is not valid for
the implementing class or the field does not have a data type of INT
.
UnsupportedFieldException
- if the field is not supported in the implementing instance of the class.
FieldFullException
- if the field already contains the maximum number of data values it can hold.public void setInt(int field, int index, int attributes, int value)
Vector.setElementAt
. This
method cannot be used to add new values to a field; use
addInt(int, int, int)
.
PIMList.isSupportedField(int)
should be used to verify the
field validity for this item prior to invoking this method.
field
- The field to which the value belongs.index
- an index to a particular value associated with the field.attributes
- a bit array specifying any optional attributes describing this value. These
attributes are a hint to the about the value's characteristics and some or all
may be ignored by this method due to platform restrictions. Attributes that are
invalid or not applicable are also ignored.value
- The new value
of the data at the field's index. java.lang.IllegalArgumentException
- if the field is not valid for
the implementing class, or the field cannot be set to the value provided (e.g.
the value is not valid for that field or this field's value is read-only).
UnsupportedFieldException
- if the field is not supported in the implementing instance of the class.
java.lang.IndexOutOfBoundsException
- if the index is negative or
greater than or equal to the number of values currently contained in the field.public java.lang.String getString(int field, int index)
PIMList.isSupportedField(int)
should be used to verify the
field validity for this item prior to invoking this method. The returned string
contains no "escaped" characters that may have been used when importing the
field's data.
field
- The field from which the data is
retrieved.index
- an index to a particular value associated with
the field. java.lang.IllegalArgumentException
- if the field is not valid for
the implementing class.
java.lang.IndexOutOfBoundsException
- if the index is negative or
greater than or equal to the number of values currently contained in the field.
UnsupportedFieldException
- if the field is not supported in the implementing instance of the class.public void addString(int field, int attributes, java.lang.String value)
Vector.addElement
.
PIMList.isSupportedField(int)
should be used to verify the
field validity for this item prior to invoking this method. Values given to
this method should not be "escaped"; i.e. having special characters marked in
the string by a particular escape character. Any characters that requiring
special handling such as these for importing and exporting is handled
transparently by toSerialFormat and fromSerialFormat.
field
- The field to which the value belongs.attributes
- a bit array specifying any optional attributes describing this value. These
attributes are a hint to the about the value's characteristics and some or all
may be ignored by this method due to platform restrictions. Attributes that are
invalid or not applicable are also ignored.value
- The data to add
to the field. A null String (e.g. String("")) is a valid data value for string. java.lang.IllegalArgumentException
- if the field is not valid for
the implementing class or the field does not have a data type of STRING
.
java.lang.NullPointerException
- if value
is null
.
UnsupportedFieldException
- if the field is not supported in the implementing instance of the class.
FieldFullException
- if the field already contains the maximum number of data values it can hold.public void setString(int field, int index, int attributes, java.lang.String value)
Vector.setElementAt
. This
method cannot be used to add new values to a field; use
addString(int, int, java.lang.String)
.
PIMList.isSupportedField(int)
should be used to verify the
field validity for this item prior to invoking this method. Values given to
this method should not be "escaped"; i.e. having special characters marked in
the string by a particular escape character. Any characters that requiring
special handling such as these for importing and exporting is handled
transparently by toSerialFormat and fromSerialFormat.
field
- The field to which the value belongs.index
- an index to a particular value associated with the field.attributes
- a bit array specifying any optional attributes describing this value. These
attributes are a hint to the about the value's characteristics and some or all
may be ignored by this method due to platform restrictions. Attributes that are
invalid or not applicable are also ignored.value
- The new value
of the data at the field's index. A null String (e.g. String("")) is a valid
data value for string. java.lang.IllegalArgumentException
- if the field is not valid for
the implementing class, or the field cannot be set to the value provided (e.g.
the value is not valid for that field or this field's value is read-only).
java.lang.NullPointerException
- if value
is null
.
UnsupportedFieldException
- if the field is not supported in the implementing instance of the class.
java.lang.IndexOutOfBoundsException
- if the index is negative or
greater than or equal to the number of values currently contained in the field.public boolean getBoolean(int field, int index)
PIMList.isSupportedField(int)
should be used to verify the
field validity for this item prior to invoking this method.
field
- The field from which the data is
retrieved.index
- an index to a particular value associated with
the field. java.lang.IllegalArgumentException
- if the field is not valid for
the implementing class.
java.lang.IndexOutOfBoundsException
- if the index is negative or
greater than or equal to the number of values currently contained in the field.
UnsupportedFieldException
- if the field is not supported in the implementing instance of the class.public void addBoolean(int field, int attributes, boolean value)
Vector.addElement
.
PIMList.isSupportedField(int)
should be used to verify the
field validity for this item prior to invoking this method.
field
- The field to which the value belongs.attributes
- a bit array specifying any optional attributes describing this value. These
attributes are a hint to the about the value's characteristics and some or all
may be ignored by this method due to platform restrictions. Attributes that are
invalid or not applicable are also ignored.value
- The data to add
to the field. java.lang.IllegalArgumentException
- if the field is not valid for
the implementing class or the field does not have a data type of BOOLEAN
.
UnsupportedFieldException
- if the field is not supported in the implementing instance of the class.
FieldFullException
- if the field already contains the maximum number of data values it can hold.public void setBoolean(int field, int index, int attributes, boolean value)
Vector.setElementAt
.
This method cannot be used to add new values to a field; use
addBoolean(int, int, boolean)
.
PIMList.isSupportedField(int)
should be used to verify the
field validity for this item prior to invoking this method.
field
- The field to which the value belongs.index
- an index to a particular value associated with the field.attributes
- a bit array specifying any optional attributes describing this value. These
attributes are a hint to the about the value's characteristics and some or all
may be ignored by this method due to platform restrictions. Attributes that are
invalid or not applicable are also ignored.value
- The new value
of the data at the field's index. java.lang.IllegalArgumentException
- if the field is not valid for
the implementing class, or the field cannot be set to the value provided (e.g.
the value is not valid for that field or this field's value is read-only).
UnsupportedFieldException
- if the field is not supported in the implementing instance of the class.
java.lang.IndexOutOfBoundsException
- if the index is negative or
greater than or equal to the number of values currently contained in the field.public java.lang.String[] getStringArray(int field, int index)
PIMList.isSupportedField(int)
should be used to verify the
field validity for this item prior to invoking this method.
Not all elements in the array are required to be supported by the item. If an
array index is not supported by this item, null
is the value for
the String at the array index.
field
- The field from which the data is
retrieved.index
- an index to a particular value associated with
the field. java.lang.IllegalArgumentException
- if the field is not valid for
the implementing class.
java.lang.IndexOutOfBoundsException
- if the index is negative or
greater than or equal to the number of values currently contained in the field.
UnsupportedFieldException
- if the field is not supported in the implementing instance of the class.public void addStringArray(int field, int attributes, java.lang.String[] value)
Vector.addElement
.
PIMList.isSupportedField(int)
should be used to verify the
field validity for this item prior to invoking this method.
Not all elements in the array are required to be supported by the item. If a
String is provided at an array index that is not supported by this item, that
value is silently discarded.
PIMList.isSupportedArrayElement(int, int)
should be used
to verify the validity of the array element prior to invoking this method.
field
- The field to which the value belongs.attributes
- a bit array specifying any optional attributes describing this value. These
attributes are a hint to the about the value's characteristics and some or all
may be ignored by this method due to platform restrictions. Attributes that are
invalid or not applicable are also ignored.value
- The data to add
to the field. At least one index in the array must contain a String object. java.lang.IllegalArgumentException
- if the field is not valid for
the implementing class or all of the strings in the array are null
or the field does not have a data type of STRING_ARRAY
.
java.lang.NullPointerException
- if value
is null
.
UnsupportedFieldException
- if the field is not supported in the implementing instance of the class.
FieldFullException
- if the field already contains the maximum number of data values it can hold.public void setStringArray(int field, int index, int attributes, java.lang.String[] value)
Vector.setElementAt
.
This method cannot be used to add new values to a field; use
addStringArray(int, int, java.lang.String[])
.
PIMList.isSupportedField(int)
should be used to verify the
field validity for this item prior to invoking this method.
Not all elements in the array are required to be supported by the item. If a
String is provided at an array index that is not supported by this item, that
value is silently discarded.
PIMList.isSupportedArrayElement(int, int)
should be used
to verify the validity of the array element prior to invoking this method.
field
- The field to which the value belongs.index
- an index to a particular value associated with the field.attributes
- a bit array specifying any optional attributes describing this value. These
attributes are a hint to the about the value's characteristics and some or all
may be ignored by this method due to platform restrictions. Attributes that are
invalid or not applicable are also ignored.value
- The new value
of the data at the field's index. At least one index in the array must contain
a String object. java.lang.NullPointerException
- if value
is null
.
java.lang.IllegalArgumentException
- if the field is not valid for
the implementing class, all of the strings in the array are null
,
or the field cannot be set to the value provided (e.g. the value is not valid
for that field or this field's value is read-only).
UnsupportedFieldException
- if the field is not supported in the implementing instance of the class.
java.lang.IndexOutOfBoundsException
- if the index is negative or
greater than or equal to the number of values currently contained in the field.public int countValues(int field)
field
- The field from which the current count
of values is returned. java.lang.IllegalArgumentException
- if the field is not valid for
the implementing class.
UnsupportedFieldException
- if the field is not supported in the implementing instance of the class.public void removeValue(int field, int index)
Vector.removeElement(Object)
.
field
- The field from which the data is
removed.index
- an index to a particular value associated with the
field. java.lang.IllegalArgumentException
- if the field is not valid for
the implementing class.
java.lang.IndexOutOfBoundsException
- if the index is negative or
greater than or equal to the number of values currently contained in the field.
UnsupportedFieldException
- if the field is not supported in the implementing instance of the class.public int getAttributes(int field, int index)
field
- The field from which the data is
removed.index
- an index to a particular value associated with the
field. java.lang.IllegalArgumentException
- if the field is not valid for
the implementing class.
java.lang.IndexOutOfBoundsException
- if the index is negative or
greater than or equal to the number of values currently contained in the field.
UnsupportedFieldException
- if the field is not supported in the implementing instance of the class.public void addToCategory(java.lang.String category) throws PIMException
PIMList.getCategories()
from the list associated with this
item. Some devices may not allow categories to be added which are not in the
list returned from
PIMList.getCategories()
. In this case a PIMException
may be thrown. If the given category is already associated with this item, the
category is not added again and the method call is considered successful and
returns.
The category names are case sensitive in this API, but not necessarily in the underlying implementation. For example, "Work" and "WORK" map to the same underlying category if the platform's implementation of categories is case-insensitive; adding both separately would result in the item being assigned to only one category in this case.
category
- the category to add java.lang.NullPointerException
- if category
is null
.
PIMException
- may be thrown if category is not in the list's category list and the list
prevents that condition from occurring. Also thrown if categories are not
supported in the implementation. Also thrown if the max categories that this
item can be assigned to is exceeded.public void removeFromCategory(java.lang.String category)
The category names are case sensitive in this API, but not necessarily in the underlying implementation. For example, "Work" and "WORK" map to the same underlying category if the platform's implementation of categories is case-insensitive; removing both separately would result in the item being removed from only one category in this case.
category
- the category to remove java.lang.NullPointerException
- if category
is null
public java.lang.String[] getCategories()
public int maxCategories()
|
Final Release Rev. 1.00 |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |