com.j_spaces.map
Class Envelope

java.lang.Object
  extended by com.j_spaces.core.client.ExternalEntry
      extended by com.j_spaces.map.Envelope
All Implemented Interfaces:
IGSEntry, Serializable, Cloneable, Map.Entry, Entry

public class Envelope
extends ExternalEntry
implements Map.Entry

This class holds key, value and Attributes that are associated with the key. key is user-defined object that refers to the value. keys are assumed to be unique. For internal use only!

See Also:
Serialized Form

Field Summary
static int CACHE_ID
          the cache id index in the values array.
static String ENVELOPE_CLASS_NAME
          this constant using for build entry UID using ClientUIDHandler.
static int KEY
          the key index in the values array.
static int VALUE
          the value index in the values array.
 
Fields inherited from class com.j_spaces.core.client.ExternalEntry
_objectFormat, m_ClassName, m_ExtendedMatchCodes, m_FieldsNames, m_FieldsTypes, m_FieldsValues, m_IndexIndicators, m_isFifo, m_isTransient, m_MultipleUIDs, m_NOWriteLeaseMode, m_PrimaryKeyName, m_RangeValues, m_RangeValuesInclusion, m_Replicatable, m_ReturnOnlyUids, m_SuperClassesNames, m_TimeToLive, m_UID, m_VersionID, routingFieldName
 
Constructor Summary
Envelope()
          default constructor - used for snapshot and notify.
Envelope(Object key, Object value)
          Constructor with key and its value.
Envelope(Object key, Object value, String cacheID)
          Constructor with key and its value.
Envelope(String uid, Object key)
          Constructor with uid and key.
 
Method Summary
static String getCacheID(ExternalEntry envelope)
          Extracts the CacheId from an Envelope.
 Object getKey()
           
static Object getKey(ExternalEntry envelope)
          Extracts the key from an Envelope.
 Map.Entry getMapEntry()
          Returns a Map.Entry (key-value pair) representation of this entity. Relevant when interacting with the Space using Map API; otherwise a null is returned.
 Object getValue()
           
static Object getValue(ExternalEntry envelope)
          Extracts the value from an Envelope.
 Object setKey(Object newKey)
           
 Object setValue(Object newValue)
           
 String toString()
          Returns a string representation of the Envelope.
 
Methods inherited from class com.j_spaces.core.client.ExternalEntry
clone, equals, equals, getClassName, getCodebase, getEntry, getExtendedMatchCode, getExtendedMatchCodes, getExternalEntry, getFieldPosition, getFieldsNames, getFieldsTypes, getFieldsValues, getFieldType, getFieldValue, getFieldValue, getFormat, getIndexIndicators, getMultipleUIDs, getObject, getPrimaryKeyName, getRangeValue, getRangeValueInclusion, getRangeValues, getRoutingFieldName, getSuperClassesNames, getTimeToLive, getUID, getVersion, getVersionID, hashCode, isExtended, isFifo, isIndexedField, isNOWriteLeaseMode, isReplicatable, isReturnOnlyUids, isTransient, makePersistent, makeTransient, readExternal, setClassName, setExtendedMatchCodes, setFieldsNames, setFieldsTypes, setFieldsValues, setFieldValue, setFieldValue, setFifo, setFormat, setIndexIndicators, setMultipleUIDs, setNOWriteLeaseMode, setPrimaryKeyName, setRangeValues, setReplicatable, setReturnOnlyUids, setRoutingFieldName, setSuperClassesNames, setTimeToLive, setUID, setVersionID, writeExternal
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface java.util.Map.Entry
equals, hashCode
 

Field Detail

KEY

public static final int KEY
the key index in the values array.

See Also:
Constant Field Values

VALUE

public static final int VALUE
the value index in the values array.

See Also:
Constant Field Values

CACHE_ID

public static final int CACHE_ID
the cache id index in the values array.

See Also:
Constant Field Values

ENVELOPE_CLASS_NAME

public static final String ENVELOPE_CLASS_NAME
this constant using for build entry UID using ClientUIDHandler.

Constructor Detail

Envelope

public Envelope()
default constructor - used for snapshot and notify.


Envelope

public Envelope(Object key,
                Object value,
                String cacheID)
Constructor with key and its value.

Parameters:
key - user-defined object that refers to the value
value - value that is associated with the key
cacheID - cache unique uid

Envelope

public Envelope(String uid,
                Object key)
Constructor with uid and key.

Parameters:
uid - space uid that represents
key - user-defined object that refers to the value

Envelope

public Envelope(Object key,
                Object value)
Constructor with key and its value.

Parameters:
key - user-defined object that refers to the value
value - value that is associated with the key
Method Detail

toString

public String toString()
Returns a string representation of the Envelope. This method returns a string equal to the value of:
 "key: " + key + " value: " + value
 

Overrides:
toString in class ExternalEntry
Returns:
a string representation of the object.

getKey

public static Object getKey(ExternalEntry envelope)
Extracts the key from an Envelope.

Parameters:
envelope - the envelope that holds the key
Returns:
the Envelope key

getValue

public static Object getValue(ExternalEntry envelope)
Extracts the value from an Envelope.

Parameters:
envelope - the envelope that holds the value
Returns:
the Envelope value

getCacheID

public static String getCacheID(ExternalEntry envelope)
Extracts the CacheId from an Envelope.

Parameters:
envelope - the envelope that holds the CacheID
Returns:
the envelope CacheID

getMapEntry

public Map.Entry getMapEntry()
Returns a Map.Entry (key-value pair) representation of this entity. Relevant when interacting with the Space using Map API; otherwise a null is returned.

Specified by:
getMapEntry in interface IGSEntry
Overrides:
getMapEntry in class ExternalEntry
Returns:
a Map.Entry representation of this entity; null if no representation.
See Also:
Map.Entry

getKey

public Object getKey()
Specified by:
getKey in interface Map.Entry

setKey

public Object setKey(Object newKey)

getValue

public Object getValue()
Specified by:
getValue in interface Map.Entry

setValue

public Object setValue(Object newValue)
Specified by:
setValue in interface Map.Entry