Overview | Package | Class | Use | Tree | Deprecated | Index | Help
| Business Components
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## oracle.jbo
Class Key

    java.lang.Object
      |
      +--oracle.jbo.Key

public class Key
extends java.lang.Object
implements java.lang.Cloneable, java.io.Serializable, AttributeList

A primary, foreign, or composite row identifier.

Users should not modify keys: JDeveloper treats keys as if they are immutable.

Call `getKey()` on a row object to get its unique identifier.

Since:
  JDeveloper 3.0
See Also:
  Serialized Form

Constructor Summary
`Key(byte[] keyBytes)` Internal.
`Key(java.lang.Object[] keyValues)` Constructs a Primary Key from a set of key values.
`Key(java.lang.Object[] keyValues, long sig, java.lang.Object rowHandle)` Internal: em>Applications should not invoke this method.
`Key(java.lang.String sString)` Initializes the Key object from it's string representation.
`Key(java.lang.String sString, AttributeDef[] keyAttrs)`

Method Summary
`boolean` | `equals(java.lang.Object val)` Tests for equality.
`java.lang.Object` | `getAttribute(int index)` Gets the value for a selected column.
`java.lang.Object` | `getAttribute(java.lang.String p0)` Gets the value of an attribute.
`int` | `getAttributeCount()` Counts the number of columns that define the key.
`int` | `getAttributeIndexOf(java.lang.String p0)` Gets the index of column identified by name.
`java.lang.Object[]` | `getKeyValues()` Internal: em>Applications should not invoke this method.
`java.lang.Object` | `getRowHandle()` Internal: em>Applications should not invoke this method.
`long` | `getSignature()` Internal: em>Applications should not invoke this method.
`int` | `hashCode()` Generates a hashcode for this key.
`boolean` | `isNull()` Checks if this key is `null`.
`static boolean` | `isNullKeyValues(java.lang.Object[] keyValues)` Finds if the key values are `null`.
`void` | `setAttribute(int p0, java.lang.Object p1)` Sets a key value.
`void` | `setAttribute(java.lang.String p0, java.lang.Object p1)` Sets the value of a column identified by name.
`byte[]` | `toByteArray()` Internal: em>Applications should not invoke this method.
`byte[]` | `toByteArray(boolean bSignature)` Internal: em>Applications should not invoke this method.
`java.lang.String` | `toString()` Internal: For debugging only.
`java.lang.String` | `toStringFormat()` Converts the Key to a String representation.
`java.lang.String` | `toStringFormat(boolean bSignature)` Converts the Key to a String representation.

Methods inherited from class java.lang.Object
`clone, finalize, getClass, notify, notifyAll, wait, wait, wait`

Constructor Detail

### Key

    public Key(java.lang.Object[] keyValues)

  Constructs a Primary Key from a set of key values.

  None of the key values may be `null`. The key values should be ordered as in the metadata defintion for the given row.

  Parameters:
    `keyValues` - an array of key values.

### Key

    public Key(java.lang.Object[] keyValues,
               long sig,
               java.lang.Object rowHandle)

  Internal: em>Applications should not invoke this method.

### Key

    public Key(java.lang.String sString,
               AttributeDef[] keyAttrs)
        throws java.lang.Exception

### Key

    public Key(java.lang.String sString)
        throws java.lang.Exception

  Initializes the Key object from it's string representation. The String representation must be obtained via the toStringFormat() function.

### Key

    public Key(byte[] keyBytes)
        throws java.io.IOException,
               java.lang.ClassNotFoundException

  Internal.

  Applications should not invoke this method.

Method Detail

### toStringFormat

    public java.lang.String toStringFormat(boolean bSignature)

  Converts the Key to a String representation. This is useful in that you can later materialize the Key object via it's string constructor. If bSignature is true, adds the Row handle as well as VO signature to the key string so that if a client connects to the same AM instance, the AM could find out the same VO and same Row based on these ids.

### getSignature

    public long getSignature()

  Internal: em>Applications should not invoke this method.

### getRowHandle

    public java.lang.Object getRowHandle()

  Internal: em>Applications should not invoke this method.

### equals

    public boolean equals(java.lang.Object val)

  Tests for equality.

  Keys are considered to be equal if they have the same number of columns, and values in each column are equal.

  Overrides:
    equals in class java.lang.Object
  Parameters:
    `val` - a key to be compaired to `this`.
  Returns:
    `true` if `val` is a key, and is equal to `this`.

### isNullKeyValues

    public static boolean isNullKeyValues(java.lang.Object[] keyValues)

  Finds if the key values are `null`.
  Returns:
    `true` if `keyValues` is empty or if all its values are `null`.

### isNull

    public boolean isNull()

  Checks if this key is `null`.
  Returns:
    `true` if this key's has no values, or if all its values are `null`.

### hashCode

    public int hashCode()

  Generates a hashcode for this key.
  Overrides:
    hashCode in class java.lang.Object
  Returns:
    the hashcode for the key.

### toString

    public java.lang.String toString()

  Internal: For debugging only.
  Overrides:
    toString in class java.lang.Object
  Returns:
    a diagnostic string.

### toByteArray

    public byte[] toByteArray(boolean bSignature)

  Internal: em>Applications should not invoke this method.

### getKeyValues

    public java.lang.Object[] getKeyValues()

  Internal: em>Applications should not invoke this method.

### getAttributeCount

    public int getAttributeCount()

  Counts the number of columns that define the key.
  Specified by:
    getAttributeCount in interface AttributeList
  Returns:
    the number of columns.

### getAttribute

    public java.lang.Object getAttribute(int index)

  Gets the value for a selected column.
  Specified by:
    getAttribute in interface AttributeList
  Parameters:
    `index` - the position of the column, where the leftmost column has an index of zero.
  Returns:
    the value of the column.

### getAttribute

    public java.lang.Object getAttribute(java.lang.String p0)

  Gets the value of an attribute.

  This method is not implemented by this class. It may be implemented by subclasses to allow names to be used to access attributes.

  Specified by:
    getAttribute in interface AttributeList
  Parameters:
    `p0` - ignored.
  Returns:
    the column's value.
  Throws:
    InvalidOperException - a runtime exception, whenever invoked.

### setAttribute

    public void setAttribute(int p0,
                             java.lang.Object p1)

  Sets a key value.

  This method is not implemented by this class. It may be implemented by subclasses.

  Specified by:
    setAttribute in interface AttributeList
  Parameters:
    `p0` - ignored.
    `p1` - ignored.
  Throws:
    `InvalidOperException` - at runtime, always.

### setAttribute

    public void setAttribute(java.lang.String p0,
                             java.lang.Object p1)

  Sets the value of a column identified by name.

  This method is not implemented by this class. It may be implemented by subclasses that allow attributes to be modified, and to be accessed by name.

  Specified by:
    setAttribute in interface AttributeList
  Parameters:
    `p0` - ignored.
    `p1` - ignored.
  Throws:
    InvalidOperException - a runtime exception, whenever invoked.

### getAttributeIndexOf

    public int getAttributeIndexOf(java.lang.String p0)

  Gets the index of column identified by name.

  This method is not implemented by this class. It may be implemented by subclasses to allow names to be used to identify attributes.

  Specified by:
    getAttributeIndexOf in interface AttributeList
  Parameters:
    `p0` - ignored.
  Returns:
    the column index, where the leftmost column has index zero.
  Throws:
    InvalidOperException - a runtime exception, whenever invoked.

### toStringFormat

    public java.lang.String toStringFormat()

  Converts the Key to a String representation. This is useful in that you can later materialize the Key object via it's string constructor. If bSignature is true, adds the Row handle as well as VO signature to the key string so that if a client connects to the same AM instance, the AM could find out the same VO and same Row based on these ids.

### toByteArray

    public byte[] toByteArray()

  Internal: em>Applications should not invoke this method.

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
| Business Components
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD