public class ObjectId extends Object implements Comparable<ObjectId>, Externalizable
Modifier and Type | Field and Description |
---|---|
static ObjectId |
SECURITY_OVERRIDE_WBSCONTEXT_ID |
static ObjectId |
USESSION_OVERRIDE_ID |
Constructor and Description |
---|
ObjectId()
Constructs an empty
ObjectId object. |
ObjectId(Collection<?> p_pkVals)
Constructs an
ObjectId object with the given Collection of Objects. |
ObjectId(Date dtId1,
Date dtId2)
Constructs an
ObjectId object with two date values. |
ObjectId(int id)
Constructs an
ObjectId object with a given key value. |
ObjectId(int[] iaPKVals)
Constructs an
ObjectId object with up to two given key values. |
ObjectId(int iId1,
int iId2)
Constructs an
ObjectId object with two int values. |
ObjectId(Number id)
Constructs an
ObjectId object with a given key value. |
ObjectId(Object[] p_pkVals)
Constructs an
ObjectId object with the given array of Objects. |
Modifier and Type | Method and Description |
---|---|
void |
addPrimaryKeyObject(Object p_obj)
Adds an object that represents a primary key data type to this object.
|
int |
compareTo(ObjectId id)
Compares two
ObjectId objects. |
boolean |
equals(Object object)
Compares this
ObjectId to the specified object. |
static ObjectId |
fromString(String sId)
Creates an
ObjectId from a String. |
Date |
getPrimaryKeyDate()
Gets the Date represented by this object.
|
Integer |
getPrimaryKeyObject()
Gets the Integer represented by this object.
|
List<Object> |
getPrimaryKeyObjects()
Gets the key values represented by this object.
|
int |
getPrimaryKeyValue()
Gets the key value represented by this object.
|
int |
hashCode()
Gets a hashcode used when ObjectIds are stored in hashtables, etc.
|
boolean |
isMultiPartKey()
Determines if this
ObjectId object contains multiple key values. |
void |
readExternal(ObjectInput ois)
Implementation of the readExternal method to restore its
contents by calling the methods of DataInput for primitive
types and readObject for objects, strings and arrays.
|
Integer |
toInteger()
Returns an Integer representation of the object.
|
String |
toString()
Returns a string representation of the object.
|
void |
writeExternal(ObjectOutput oos)
Implementation of the writeExternal method to save its contents
by calling the methods of DataOutput for its primitive values or
calling the writeObject method of ObjectOutput for objects, strings,
and arrays.
|
public static final ObjectId SECURITY_OVERRIDE_WBSCONTEXT_ID
public static final ObjectId USESSION_OVERRIDE_ID
public ObjectId()
ObjectId
object. Must use the addPrimaryKeyObject() method
to populatepublic ObjectId(int[] iaPKVals)
ObjectId
object with up to two given key values.iaPKVals
- the array of key values.public ObjectId(Object[] p_pkVals)
ObjectId
object with the given array of Objects.p_pkVals
- the Object array holding primary key objectspublic ObjectId(Collection<?> p_pkVals)
ObjectId
object with the given Collection of Objects.p_pkVals
- the Collection holding the primary key objectspublic ObjectId(int iId1, int iId2)
ObjectId
object with two int values.iId1
- the first key value.iId2
- the second key value.public ObjectId(Date dtId1, Date dtId2)
ObjectId
object with two date values.dtId1
- the first key value.dtId2
- the second key value.public ObjectId(int id)
ObjectId
object with a given key value.id
- the key value.public ObjectId(Number id)
ObjectId
object with a given key value.id
- the key value.public void addPrimaryKeyObject(Object p_obj)
p_obj
- the object representing the primary keypublic static ObjectId fromString(String sId)
ObjectId
from a String.sId
- String to be convertedObjectId
if the string was valid, otherwise returns nullpublic List<Object> getPrimaryKeyObjects()
public int getPrimaryKeyValue() throws MultipartObjectIdException
MultipartObjectIdException
- if this object contains more than one key valuepublic Integer getPrimaryKeyObject() throws MultipartObjectIdException
MultipartObjectIdException
- if this object contains more than one key valuepublic Date getPrimaryKeyDate() throws MultipartObjectIdException
MultipartObjectIdException
- if this object contains more than one key valuepublic String toString()
public Integer toInteger()
public boolean isMultiPartKey()
ObjectId
object contains multiple key values.public boolean equals(Object object)
ObjectId
to the specified object. The result is true if and only
if the argument is not null and is an ObjectId
object that contains the same
sequence of key values.public int hashCode()
public int compareTo(ObjectId id)
ObjectId
objects.compareTo
in interface Comparable<ObjectId>
id
- the Object
to be compared.0
if the argument is an ObjectId
and equal to
this ObjectId
; a value less than 0
if the argument is an
ObjectId
, and the length of its key values is greater than that of
this ObjectId
,or its key values are greater than the key values of
this ObjectId
, or if the argument is not an ObjectId
; a
value greater than 0
if the argument is an ObjectId
, and
the length of its key values is less than that of this ObjectId
,or
its key values are less than the key values of this ObjectId
.public void writeExternal(ObjectOutput oos) throws IOException
writeExternal
in interface Externalizable
oos
- the stream to write the object toIOException
- Includes any I/O exceptions that may occurpublic void readExternal(ObjectInput ois) throws ClassNotFoundException, IOException
readExternal
in interface Externalizable
ois
- the stream to read data from in order to restore the objectIOException
- if I/O errors occurClassNotFoundException
- If the class for an object being
restored cannot be found.Copyright © 2003, 2022, Oracle and/or its affiliates.
Oracle®, Java, and MySQL are registered trademarks of Oracle and/or its affiliates. Other names may be trademarks of their respective owners.