Cool documentation

com.sap.tc.col.client.generic.api
Interface IKey


public interface IKey

represents an interface for the unique Key of an AspectRow. Key objects are strict value objects. That is, two objects are equal, if they have the same value (same number and order of fields with equal values for corresponding key fields), and not only if they are represented by the same Java reference.

This makes a Key object a good way to identify an AspectRow, even across caching, transactions or connection boundaries. Even if AspectRows or Aspects get invalid, the Key object remains valid and usable. If data equivalent to the original Aspect is retrieved again from backend and returned as a new Aspect instance, then the equivalent AspectRow can be found by its Key.

After a successful insert operation, the value of a Key cannot change anymore. But if we have an insert, where the Key was not known before insert, we have a transition from local Key ( no or incomplete field values ) to complete business Key from Backend. Cause this transition from local to complete Key leads to a hashCode change, a local Key should not be used in a HashMap or somethig like this, or you have to consider this after a flush of inserted AspectRows.


Method Summary
 java.lang.String[] getFields()
          Returns a copy of the Key fields of this Key as String array, or null, if Key is a local Key.
 boolean isLocalKey()
          Returns true if this key is a local key, not yet knwon to the backend.
 java.lang.String toString()
          returns a String representation of this Key.
 

Method Detail

isLocalKey

public boolean isLocalKey()
Returns true if this key is a local key, not yet knwon to the backend. If an IKey is not a local key, it is guaranteed to be a strict value object.

getFields

public java.lang.String[] getFields()
Returns a copy of the Key fields of this Key as String array, or null, if Key is a local Key.
Returns:
String[] the Key fields of this Key as String array, or null, if Key is a local Key.

toString

public java.lang.String toString()
returns a String representation of this Key. If Key contains the fields "name1" and "name2" for example the String representation looks like:
 [name1, name2] 
Overrides:
toString in class java.lang.Object
Returns:
String a String representation of this Key

Cool documentation

Copyright © 2002 SAP AG. Automatically generated Thu Mar 3 2005, 21:55