com.compoze.collab
Class Key

java.lang.Object
  extended by com.compoze.collab.Key
All Implemented Interfaces
IDigestSupport, Serializable
Direct Known Subclasses:
CustomNamedKey

public class Key
extends Object
implements Serializable, IDigestSupport

A key for properties that are set on an item. Keys can represent normal, calculated or read-only properties. Normal properties may be read from and written to the provider. Read-only properties may not be written to the provider. Calculated properties are always read-only, and are not even retrieved from the provider.

See Also
Serialized Form

Field Summary
static int BASE_TYPE_MASK
           
static Key[] EMPTY_KEY_ARRAY
          A Key[0] array, for when needed
static String EMPTY_STRING
           
protected static HashMap s_keyMap
           
static int VALUE_ARRAY
          When ORed with another value type (for example VALUE_STRING | VALUE_ARRAY) represents an array of that value type.
static int VALUE_BINARY
          The key represents binary data (a byte array).
static int VALUE_BOOLEAN
          The key represents a boolean (true/false).
static int VALUE_DATE
          The key represents a date and time.
static int VALUE_DOUBLE
          The key represents a 64 bit floating point value.
static int VALUE_ENUMELEMENT
          The key represents an enumeration value.
static int VALUE_FLOAT
          The key represents a 32 bit floating point value.
static int VALUE_INTEGER
          The key represents a 32 bit signed value.
static int VALUE_ITEM
          The key represents another item.
static int VALUE_LONG
          The key represents a 64 bit signed value.
static int VALUE_SERIALIZABLE
          The key represents a serializable java object.
static int VALUE_SHORT
          The key represents is a 16 bit signed value.
static int VALUE_STRING
          The key represents a unicode string.
static int VALUE_UNKNOWN
          The key represents a unknown data type.
 
Constructor Summary
Key(String sID, int iValueType)
          Constructor (read-write key).
Key(String sID, int iValueType, boolean bReadOnly)
          Constructor.
Key(String sID, int iValueType, boolean bReadOnly, boolean bCalculated, int iID)
          Constructor.
Key(String sID, int iValueType, boolean bReadOnly, int iID)
          Constructor.
Key(String sID, int iValueType, int iID)
          Constructor (read-write key).
 
Method Summary
static Key[] combine(Key[] keys1, Key[] keys2)
          Combines two key arrays, removing duplicates.
 boolean equals(Object obj)
          Two keys are equal if they share IDs.
static Key get(String sID)
          Gets a key by its ID.
 String getID()
          Gets an ID for the key that is unique across VM invocations.
 int getIntID()
          Get the integer ID
 int getValueType()
          Gets the type of values associated with this key.
 String getValueTypeName()
          Gets the name of the value type of a Key.
 int hashCode()
           
 boolean isCalculated()
          Determines if the key is for a calculated property.
 boolean isReadOnly()
          Determines if the key is for a read-only property.
static String staticValueTypeName(int iValueType)
          Gets the name of a value type.
 String toString()
           
 void updateDigest(MessageDigest digest)
          Updates the specified MessageDigest with the object's internal state.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

EMPTY_STRING

public static final String EMPTY_STRING
See Also
Constants Summary

s_keyMap

protected static final HashMap s_keyMap

VALUE_STRING

public static final int VALUE_STRING
The key represents a unicode string.

See Also
Constants Summary

VALUE_SHORT

public static final int VALUE_SHORT
The key represents is a 16 bit signed value.

See Also
Constants Summary

VALUE_INTEGER

public static final int VALUE_INTEGER
The key represents a 32 bit signed value.

See Also
Constants Summary

VALUE_LONG

public static final int VALUE_LONG
The key represents a 64 bit signed value.

See Also
Constants Summary

VALUE_BOOLEAN

public static final int VALUE_BOOLEAN
The key represents a boolean (true/false).

See Also
Constants Summary

VALUE_FLOAT

public static final int VALUE_FLOAT
The key represents a 32 bit floating point value.

See Also
Constants Summary

VALUE_DOUBLE

public static final int VALUE_DOUBLE
The key represents a 64 bit floating point value.

See Also
Constants Summary

VALUE_BINARY

public static final int VALUE_BINARY
The key represents binary data (a byte array).

See Also
Constants Summary

VALUE_DATE

public static final int VALUE_DATE
The key represents a date and time.

See Also
Constants Summary

VALUE_ITEM

public static final int VALUE_ITEM
The key represents another item.

See Also
Constants Summary

VALUE_ENUMELEMENT

public static final int VALUE_ENUMELEMENT
The key represents an enumeration value.

See Also
Constants Summary

VALUE_UNKNOWN

public static final int VALUE_UNKNOWN
The key represents a unknown data type.

See Also
Constants Summary

VALUE_SERIALIZABLE

public static final int VALUE_SERIALIZABLE
The key represents a serializable java object.

See Also
Constants Summary

VALUE_ARRAY

public static final int VALUE_ARRAY
When ORed with another value type (for example VALUE_STRING | VALUE_ARRAY) represents an array of that value type. Note that arrays of some types (VALUE_SHORT, VALUE_INTEGER, VALUE_LONG, VALUE_FLOAT, VALUE_DOUBLE, VALUE_BOOLEAN) represent arrays of the Java base type, not the Java class wrapper type, so VALUE_INTEGER | VALUE_ARRAY represents int[], NOT as Integer[], even though VALUE_INTEGER represents Integer. VALUE_ITEM | VALUE_ARRAY represents IItem[]--an array of a subclass of IItem can be saved in an item array property (for example, IRecipient[]) but it will be retrieved as an IItem[].

See Also
Constants Summary

BASE_TYPE_MASK

public static final int BASE_TYPE_MASK
See Also
Constants Summary

EMPTY_KEY_ARRAY

public static final Key[] EMPTY_KEY_ARRAY
A Key[0] array, for when needed

Constructor Detail

Key

public Key(String sID,
           int iValueType)
Constructor (read-write key).

Parameters
sID - the key ID
iValueType - the type for values associated with this key

Key

public Key(String sID,
           int iValueType,
           int iID)
Constructor (read-write key).

Parameters
sID - the key ID
iValueType - the type for values associated with this key
iID - the key integer ID

Key

public Key(String sID,
           int iValueType,
           boolean bReadOnly)
Constructor.

Parameters
sID - the key ID
iValueType - the type for values associated with this key
bReadOnly - if true then the key is for a read-only property

Key

public Key(String sID,
           int iValueType,
           boolean bReadOnly,
           int iID)
Constructor.

Parameters
sID - the key ID
iValueType - the type for values associated with this key
bReadOnly - if true then the key is for a read-only property
iID - an internal integer ID for this key
Throws
InvalidArgumentException - if the specified int key ID has already been added

Key

public Key(String sID,
           int iValueType,
           boolean bReadOnly,
           boolean bCalculated,
           int iID)
Constructor.

Parameters
sID - the key ID
iValueType - the type for values associated with this key
bReadOnly - if true then the key is for a read-only property
bCalculated - if true then the key is for a calculated property
iID - an internal integer ID for this key
Throws
InvalidArgumentException - if the specified int key ID has already been added
Method Detail

combine

public static Key[] combine(Key[] keys1,
                            Key[] keys2)
Combines two key arrays, removing duplicates.

Parameters
keys1 - the first key array (not null)
keys2 - the second key array (not null)
Returns
the combined key array (not null)

getIntID

public int getIntID()
Get the integer ID

Returns
the int ID

get

public static Key get(String sID)
Gets a key by its ID.

Returns
the key

getID

public String getID()
Gets an ID for the key that is unique across VM invocations.

Returns
the key ID

getValueType

public int getValueType()
Gets the type of values associated with this key.

Returns
the value type (one of the VALUE_ constants)

isReadOnly

public boolean isReadOnly()
Determines if the key is for a read-only property. Read-only properties may not be written to the provider.

Returns
true if the key is for a read-only property

isCalculated

public boolean isCalculated()
Determines if the key is for a calculated property. Calculated properties are evaluated by the API itself, are always read-only and are never retrieved from the provider.

Returns
true if the key is for a calculated property

equals

public boolean equals(Object obj)
Two keys are equal if they share IDs. Note that objects of different Key subclasses can be equal.

Overrides:
equals in class Object
Parameters
obj - the Object to test equality against
Returns
true if the objects are equal

hashCode

public int hashCode()
Overrides:
hashCode in class Object
See Also
Object.hashCode()

toString

public String toString()
Overrides:
toString in class Object
See Also
Object.toString()

getValueTypeName

public String getValueTypeName()
Gets the name of the value type of a Key. For trace and error message purposes.

Returns
the name of the value type

staticValueTypeName

public static String staticValueTypeName(int iValueType)
Gets the name of a value type. For trace and error message purposes.

Parameters
iValueType - the value type
Returns
the name of the value type

updateDigest

public void updateDigest(MessageDigest digest)
Description copied from interface: IDigestSupport
Updates the specified MessageDigest with the object's internal state.

Specified by:
updateDigest in interface IDigestSupport
Parameters
digest - the digest to update (not null)


Copyright © 2006 BEA Systems, Inc. All Rights Reserved