Overview | Package | Class | Use | Tree | Deprecated | Index | Help
| Oracle Application Development Framework Model Java API Reference 10g Release 3 (10.1.3) B25778-01
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## oracle.jbo
Class Key

`java.lang.Object
oracle.jbo.Key`

All Implemented Interfaces:
  oracle.jbo.AttributeList, java.lang.Cloneable, java.io.Serializable

public class Key
extends java.lang.Object
implements java.lang.Cloneable, java.io.Serializable, oracle.jbo.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)` Deprecated. Use Key(String, AttributeDefImpl) instead
`Key(java.lang.Object[] keyValues)` Constructs a 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)` Deprecated. Use Key(String, AttributeDefImpl) instead
`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.String[]` | `getAttributeNames()`
`java.lang.Object[]` | `getAttributeValues()`
`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` | `isAnyNull()` Checks if this key has any part that is `null`.
`static boolean` | `isAnyNullKeyValues(java.lang.Object[] keyValues)` Checks if any of the key values is `null`.
`boolean` | `isNull()` Checks if this key is `null`.
`static boolean` | `isNullKeyValues(java.lang.Object[] keyValues)` Checks 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()` Deprecated. Use toByteArray(boolean bSignature) instead
`byte[]` | `toByteArray(boolean bSignature)` Internal: em>Applications should not invoke this method.
`java.lang.String` | `toString()` Internal: For debugging only.
`java.lang.String` | `toStringFormat()` Deprecated. Use toStringFormat(boolean bSignature) instead
`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 Key from a set of key values.

  A key may be constructed to identify a row or a set of rows. If it is to identify a unique row, the key values must match the row's key attributes exactly.

  A partial key (where some key values are `null`) may be used to locate a set of partially matching rows. This is applicable only for `oracle.jbo.RowIterator's findByKey(Key)` method. See ``RowIterator.findByKey(Key,int)`` for details.

  The key values should be ordered as in the defintion for the given row (that of the Entity or the View Object).

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

  Deprecated. Use Key(String, AttributeDefImpl) instead
  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

  Deprecated. Use Key(String, AttributeDefImpl) instead
  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.

  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)

  Checks 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`.

### isAnyNullKeyValues

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

  Checks if any of the key values is `null`.
  Returns:
    `true` if `keyValues` is empty or if any of its values is `null`.

### isAnyNull

    public boolean isAnyNull()

  Checks if this key has any part that is `null`.
  Returns:
    `true` if this key has any null part.

### hashCode

    public int hashCode()

  Generates a hashcode for this key.
  Returns:
    the hashcode for the key.

### toString

    public java.lang.String toString()

  Internal: For debugging only.
  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 `oracle.jbo.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 `oracle.jbo.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 `oracle.jbo.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 `oracle.jbo.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 `oracle.jbo.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 `oracle.jbo.AttributeList`
  Parameters:
    `p0` - ignored.
  Returns:
    the column index, where the leftmost column has index zero.
  Throws:
    `InvalidOperException` - a runtime exception, whenever invoked.

### getAttributeNames

    public java.lang.String[] getAttributeNames()

  Specified by:
    `getAttributeNames` in interface `oracle.jbo.AttributeList`

### getAttributeValues

    public java.lang.Object[] getAttributeValues()

  Specified by:
    `getAttributeValues` in interface `oracle.jbo.AttributeList`

### toStringFormat

    public java.lang.String toStringFormat()

  Deprecated. Use toStringFormat(boolean bSignature) instead
  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()

  Deprecated. Use toByteArray(boolean bSignature) instead
  Internal: em>Applications should not invoke this method.

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
| Oracle Application Development Framework Model Java API Reference 10g Release 3 (10.1.3) B25778-01
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 1997, 2005, Oracle. All rights reserved.