Modifier and Type | Class and Description |
---|---|
class |
SurrogateImpl.InvalidDBObject
An InvalidDBObject implements an invalid
DBObject . |
Constructor and Description |
---|
SurrogateImpl(DatabaseBackend db,
DBObjectType dot,
DBObjectId id)
Construct a
Surrogate . |
Modifier and Type | Method and Description |
---|---|
boolean |
equals(Object obj) |
DatabaseBackend |
getDatabase()
Return the database of the database object.
|
DBObjectType |
getDBObjectType()
Return a keyword identifying the type of database object of this surrogate.
|
DBObjectId |
getId()
Return the id of this database object.
|
DBObject |
getObject()
Returns the database object corresponding to the surrogate.
|
int |
hashCode()
Return the hashCode of this surrogate unless it is in construction.
|
boolean |
inConstruction()
Test whether the data object is in the database or is a new object being
constructed.
|
protected static Surrogate |
makeSurrogate(DatabaseBackend db,
String surrogate)
Create a surrogate from a string.
|
String |
toString()
Applications can rely on this method when needing to display the surrogate in a
user interface or in a report.
|
void |
upgrade(Surrogate surrogate)
Leave the in construction state and take the identity of the
parameter.
|
public SurrogateImpl(DatabaseBackend db, DBObjectType dot, DBObjectId id)
Surrogate
.db
- a database backenddot
- a database object typeid
- an idprotected static Surrogate makeSurrogate(DatabaseBackend db, String surrogate) throws T2DBException
toString()
.
The database of the surrogate must agree with the database parameter.db
- a databasesurrogate
- a string representation of a surrogateT2DBException
public void upgrade(Surrogate surrogate)
Surrogate
public DatabaseBackend getDatabase()
Surrogate
getDatabase
in interface Surrogate
public DBObjectType getDBObjectType()
Surrogate
getDBObjectType
in interface Surrogate
public DBObjectId getId()
Surrogate
getId
in interface Surrogate
DBObjectId
or nullpublic boolean inConstruction()
Surrogate
inConstruction
in interface Surrogate
public DBObject getObject()
Surrogate
public int hashCode()
Surrogate
Surrogate.inConstruction()
is true throw an IllegalStateException
.public boolean equals(Object obj)
Surrogate
Clients can rely on this method to return true when the underlying database
objects are the same. The method returns false when Surrogate.inConstruction()
is true
for one of the objects involved.
Copyright © 2017. All rights reserved.