|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectblackboard.persist.Id
blackboard.persist.PkId
public class PkId
The PkId class provides the means of describing an Id
within a Blackboard database container.
| Field Summary | |
|---|---|
static int |
DEFAULT_PK2
|
| Fields inherited from class blackboard.persist.Id |
|---|
UNSET_ID |
| Constructor Summary | |
|---|---|
PkId(Container container,
DataType dataType,
int nPk1,
int nPk2)
Instantiate a new PkId with the given Container,
DataType, and primary key values as integers. |
|
PkId(Container container,
DataType dataType,
java.lang.String strPk)
Instantiate a new PkId with the given Container,
DataType, and primary key value as a single string. |
|
PkId(Container container,
DataType dataType,
java.lang.String strPk1,
java.lang.String strPk2)
Instantiate a new PkId with the given Container,
DataType, and primary key values as strings. |
|
| Method Summary | |
|---|---|
int |
compareTo(Id obj)
The sole method of the Comparable interface. |
boolean |
equals(java.lang.Object obj)
Overrides the equals() method in
Object to provide a simple way to compare two PkIds. |
int |
getPk1()
Returns the primary key value of this PkId (PK1). |
int |
getPk2()
Returns the secondary key value of this PkId (PK2 or SOS_ID). |
int |
hashCode()
Allow Ids to be used as a key in a hash table. |
boolean |
isSet()
Determines if the PkId has been set. |
java.lang.Object |
loadObject()
Overrides load method in the base class to implement a "load
by id" operation for a database id (and thus for a database container). |
void |
setContainer()
Since Id. |
java.lang.String |
toExternalString()
Converts this PkId into its String representation. |
java.lang.String |
toString()
Converts this PkId into its String representation. |
| Methods inherited from class blackboard.persist.Id |
|---|
assertIsSet, assertMatchesContainer, assertMatchesDataType, generateId, generateId, generateId, generateIds, getContainer, getDataType, getExternalString, getIsSet, hasSameContainer, hasSameDataType, isValid, isValidPkId, load, matchesContainer, matchesDataType, newId, setContainer, setDataType, toId, toId |
| Methods inherited from class java.lang.Object |
|---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
public static final int DEFAULT_PK2
| Constructor Detail |
|---|
public PkId(Container container,
DataType dataType,
int nPk1,
int nPk2)
throws java.lang.IllegalArgumentException
PkId with the given Container,
DataType, and primary key values as integers.
container - the Container in which the object this Id
refers to residesdataType - the DataType of the object that this Id
refers tonPk1 - An int representing the primary key value.nPk2 - An int representing the secondary primary key value (SOS_ID).
java.lang.IllegalArgumentException - thrown if either of the integer values
is not a valid key representation (i.e., a negative value).
public PkId(Container container,
DataType dataType,
java.lang.String strPk1,
java.lang.String strPk2)
throws java.lang.IllegalArgumentException
PkId with the given Container,
DataType, and primary key values as strings.
container - the Container in which the object this Id
refers to residesdataType - the DataType of the object that this Id
refers tostrPk1 - A String representing the primary key value.strPk2 - A String representing the secondary primary key value (SOS_ID).
java.lang.IllegalArgumentException - thrown if either of the String values
is not a valid key representation (i.e., an int) or null.
public PkId(Container container,
DataType dataType,
java.lang.String strPk)
throws java.lang.IllegalArgumentException
PkId with the given Container,
DataType, and primary key value as a single string. The string
provided as the key value should be of the form as generated by toExternalString().
container - the Container in which the object this id
refers to residesdataType - the DataType of the object that this id
refers tostrPk - A String representing the internal id value(s).
java.lang.IllegalArgumentException - thrown if the String value can not be
interpreted as a valid key representation.| Method Detail |
|---|
public boolean isSet()
PkId has been set.
isSet in class Idpublic int getPk1()
PkId (PK1).
pkId.public int getPk2()
PkId (PK2 or SOS_ID).
PkId.public boolean equals(java.lang.Object obj)
equals() method in
Object to provide a simple way to compare two PkIds.
equals in class Idobj - the object to be compared.
public int compareTo(Id obj)
throws java.lang.ClassCastException
Comparable interface.
Used for sorting and natural-ordering algorithms.
compareTo in interface java.lang.Comparable<Id>compareTo in class Idobj - the object to be compared to.
java.lang.ClassCastException - thrown if the specified object's type
prevents it from being compared to this Objectpublic int hashCode()
hashCode in class Idpublic java.lang.String toExternalString()
PkId into its String representation. The output
of this method is designed to create an able-to-be-parsed (not necessarily
human-readable) representation of this PkId value. If a human-
readable form of this PkId is desired, use toString().
BbPersistenceManager and Container. The output of this method may be the same as that generated
by toString(), but it is not guaranteed to be. As a result, this
method should be used whenever a string value is desired that can later be
converted back into a proper PkId value.
toExternalString in class IdPkId that is able to
be parsed.toString(),
BbPersistenceManager.generateId(DataType,String),
Container.generateId(DataType,String)public java.lang.String toString()
PkId into its String representation. The output
of this method is designed to create a human-readable (not necessarily able
to be parsed) representation of this PkId value. If an "able
to be parsed" form of this PkId is desired, use toExternalString().
toString in class IdPkId that is human-
readable.toExternalString()
public java.lang.Object loadObject()
throws PersistenceException
load method in the base class to implement a "load
by id" operation for a database id (and thus for a database container).
Id object contains enough information to uniquely identify an
object in the system. First, it contains a Container, which for a
PkId (us) should be a DatabaseContainer. This value
describes the database the object should reside in. Second, an Id
contains a DataType value. This value describes the type
of object we are looking for, and thus for a PkId, describes
what database loader we can use to pull the object. Finally, an Id
contains a key. For a PkId, this value identifies the
individual object (among the type) that we are looking. This typically
means an individual row within an individual table in the database.
loadObject in class IdObject derived value that matches the current id value
PersistenceException - if an error occurs while loading the objectpublic void setContainer()
setContainer in class Id
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||