|
Holger's Java API |
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.antelmann.db.DefaultDBReference
public class DefaultDBReference
this class implements a simple DBReference object. This implementation is immutable in regards to the database reference itself; merely the reference string can be altered after construction. A DefaultDBReference may be 'empty'.
Stub,
Serialized Form| Field Summary | |
|---|---|
static DefaultDBReference |
EMPTY_REF
provides an empty DBReference (i.e. its id, class and string are null) |
| Fields inherited from interface com.antelmann.db.DBReference |
|---|
REFERENCE_FLAVOR, REFERENCE_LIST_FLAVOR |
| Constructor Summary | |
|---|---|
DefaultDBReference(Database<?> db,
Object referenceID,
Class<? extends DBEntry> referenceClass)
|
|
DefaultDBReference(DBClassStore<?> store,
Object referenceID)
|
|
DefaultDBReference(DBReference ref)
|
|
DefaultDBReference(Object referenceID,
Class<?> referenceClass,
String referenceString)
|
|
DefaultDBReference(String str)
an empty reference that merely contains the string as info |
|
| Method Summary | |
|---|---|
DBEntry |
dereference(Database<?> db)
|
void |
ensureReferenceString(Database<?> db)
|
static void |
ensureReferenceString(DBReference ref,
Database<?> db)
|
boolean |
equals(Object obj)
returns true if the given object is a DBReference and is also the same reference as defined in sameReference(DBReference) |
static DefaultDBReference |
fromEntry(DBEntry entry)
|
Class<? extends DBEntry> |
getReferenceClass()
indicates the type of DBEntry that represents the class of the reference ID, so that the instance could be looked up in a Database; this may be null only if the reference itself is null, too. |
Object |
getReferenceID()
returns the ID of the DBEntry this instance refers to; this may be null only if the reference type returns null, too. |
String |
getReferenceString()
provides a meaningful (displayable) description for the referenceID/referenceType or null if there is no reference for this entry. |
static Comparator<DBReference> |
getRefStringComparator()
|
int |
hashCode()
|
static boolean |
isAllNull(DBReference ref)
|
static boolean |
isConsistent(DBReference ref)
returns true only if the given reference applies to the rule that all relevant values (reference class and reference id) are both either null or non-null. |
boolean |
isEmpty()
|
static boolean |
isEmpty(DBReference ref)
if true is returned, this reference may still contain a reference string |
boolean |
isInstanceOf(Class<?> type)
|
static boolean |
isInstanceof(DBReference ref,
Class<?> type)
|
boolean |
refersTo(DBEntry entry)
|
static boolean |
refersTo(DBReference ref,
DBEntry entry)
|
boolean |
sameReference(DBReference ref)
|
static boolean |
sameReference(DBReference ref1,
DBReference ref2)
determines whether both given references refer to the same entry |
void |
setReferenceString(String referenceString)
|
String |
toString()
|
static DBReference |
verify(DBReference ref,
Class<?> type)
verifies that the given reference is indeed of the given type |
static DBReference |
verifyBase(DBReference ref,
Class<?> baseType)
|
| Methods inherited from class java.lang.Object |
|---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
public static final DefaultDBReference EMPTY_REF
| Constructor Detail |
|---|
public DefaultDBReference(DBClassStore<?> store,
Object referenceID)
throws DatabaseException
DatabaseException
public DefaultDBReference(Database<?> db,
Object referenceID,
Class<? extends DBEntry> referenceClass)
public DefaultDBReference(Object referenceID,
Class<?> referenceClass,
String referenceString)
throws IllegalArgumentException
referenceID - the ID of the referenced entry (or null if this is an empty reference and the referenceClass is also null)referenceClass - must be a class implementing DBEntry (in not null)referenceString - an optional String representing the entry this reference is referring to
IllegalArgumentException - if DBEntry class is not assignable from the non-null referenceClasspublic DefaultDBReference(DBReference ref)
public DefaultDBReference(String str)
| Method Detail |
|---|
public static DefaultDBReference fromEntry(DBEntry entry)
public String toString()
toString in class Objectpublic Object getReferenceID()
DBReference
getReferenceID in interface DBReferenceDBEntry.getID(),
isConsistent(DBReference)public Class<? extends DBEntry> getReferenceClass()
DBReference
getReferenceClass in interface DBReferenceDatabase,
DBEntry#getClass(),
isConsistent(DBReference)public String getReferenceString()
DBReference
getReferenceString in interface DBReferencepublic void setReferenceString(String referenceString)
public void ensureReferenceString(Database<?> db)
throws DatabaseException
DatabaseException
public static void ensureReferenceString(DBReference ref,
Database<?> db)
throws DatabaseException,
UnsupportedOperationException
DatabaseException
UnsupportedOperationException
public DBEntry dereference(Database<?> db)
throws DatabaseException
DatabaseExceptionpublic boolean isInstanceOf(Class<?> type)
public static boolean isInstanceof(DBReference ref,
Class<?> type)
public boolean refersTo(DBEntry entry)
public static boolean refersTo(DBReference ref,
DBEntry entry)
public boolean sameReference(DBReference ref)
public static boolean sameReference(DBReference ref1,
DBReference ref2)
public boolean isEmpty()
public static boolean isEmpty(DBReference ref)
throws InconsistentContentException
InconsistentContentException - if only one (id or class) is nullpublic static boolean isAllNull(DBReference ref)
public static boolean isConsistent(DBReference ref)
public static DBReference verify(DBReference ref,
Class<?> type)
throws IllegalArgumentException
ref - the reference to be checkedtype - the expected type for the reference
IllegalArgumentException - if the given reference was not of the given typeStub.verify(Stub, Class)
public static DBReference verifyBase(DBReference ref,
Class<?> baseType)
throws IllegalArgumentException
IllegalArgumentExceptionpublic boolean equals(Object obj)
sameReference(DBReference)
equals in class Objectpublic int hashCode()
hashCode in class Objectpublic static Comparator<DBReference> getRefStringComparator()
|
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||