Holger's
Java API

com.antelmann.db
Class EntryHeader<T extends DBEntry>

java.lang.Object
  extended by com.antelmann.db.AbstractDBEntry
      extended by com.antelmann.db.PropertyEntryImpl
          extended by com.antelmann.db.EntryHeader<T>
All Implemented Interfaces:
DBEntry, DBReference, PropertyEntry, DetailedString, Serializable
Direct Known Subclasses:
DBDocument.Header, GPerson.Header, ImageURLEntry.Thumbnail

public class EntryHeader<T extends DBEntry>
extends PropertyEntryImpl
implements DBReference

serves as a reference to a more complex DBEntry object while allowing for more content than a mere Stub. Commonly, EntryHeader subclasses are mapped with a read-only store to the database (e.g. using a GenericPropertyEntryStore embedded in a ReadOnlyStore) It is usually a good idea to override the toString() method.

Since:
1. Mai 2008, 20:57
Author:
Holger Antelmann
See Also:
GenericPropertyEntryStore, PropertyEntryHeaderStore, TaggableHeaderStore, ReadOnlyStore, Stub, PropertyEntryTableModel, Serialized Form

Field Summary
 
Fields inherited from class com.antelmann.db.PropertyEntryImpl
propertyChangeSupport, props, um, vcs
 
Fields inherited from interface com.antelmann.db.DBReference
REFERENCE_FLAVOR, REFERENCE_LIST_FLAVOR
 
Fields inherited from interface com.antelmann.db.DBEntry
ENTRY_FLAVOR, ENTRY_LIST_FLAVOR
 
Constructor Summary
EntryHeader(Class<T> entryType, Object id)
           
EntryHeader(Class<T> entryType, Object id, Map<String,?> properties)
           
 
Method Summary
 Stub<T> asStub()
           
 boolean equals(Object obj)
           
 String getDisplayProperty()
           
 Class<T> 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.
 T getReferenceEntry(Database<?> db)
          retrieves and returns the original object for this EntryHeader
 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.
 void setDisplayProperty(String displayProperty)
          allows to provide a displayProperty that is used when calling toString()
 String toString()
           
 
Methods inherited from class com.antelmann.db.PropertyEntryImpl
addPropertyChangeListener, addPropertyChangeListener, addVetoableChangeListener, addVetoableChangeListener, asProperties, canRedo, canUndo, checkPropertyChange, clearProperties, containsPropertyText, containsValuePattern, equalWithProperties, equalWithProperties, getBoolean, getNumber, getProperties, getProperty, getProperty, getPropertyChangeListeners, getPropertyComparator, getPropertyExtractor, getPropertyExtractor, getPropertyKeys, getStringExtractor, getVetoableChangeListeners, isCaseInsensitive, isChangeListenerSupportEnabled, isKeyIn, isUndoSupport, isVetoableChangeSupportEnabled, putAll, redo, removeProperty, removePropertyChangeListener, removeVetoableChangeListener, setAllFrom, setCaseInsensitive, setChangeListenerSupport, setProperty, setUndoSupported, setVetoableChangeSupport, toDetailedString, undo, verifyProperties
 
Methods inherited from class com.antelmann.db.AbstractDBEntry
getID, hashCode, hashEntry, sameEntry
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface com.antelmann.db.DBEntry
getID
 

Constructor Detail

EntryHeader

public EntryHeader(Class<T> entryType,
                   Object id)

EntryHeader

public EntryHeader(Class<T> entryType,
                   Object id,
                   Map<String,?> properties)
Method Detail

getDisplayProperty

public String getDisplayProperty()

setDisplayProperty

public void setDisplayProperty(String displayProperty)
allows to provide a displayProperty that is used when calling toString()


toString

public String toString()
Overrides:
toString in class AbstractDBEntry

getReferenceEntry

public T getReferenceEntry(Database<?> db)
                                    throws DatabaseException
retrieves and returns the original object for this EntryHeader

Throws:
DatabaseException

equals

public boolean equals(Object obj)
Overrides:
equals in class AbstractDBEntry

asStub

public Stub<T> asStub()

getReferenceClass

public Class<T> getReferenceClass()
Description copied from interface: DBReference
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.

Specified by:
getReferenceClass in interface DBReference
See Also:
Database, DBEntry#getClass(), DefaultDBReference.isConsistent(DBReference)

getReferenceID

public Object getReferenceID()
Description copied from interface: DBReference
returns the ID of the DBEntry this instance refers to; this may be null only if the reference type returns null, too.

Specified by:
getReferenceID in interface DBReference
See Also:
DBEntry.getID(), DefaultDBReference.isConsistent(DBReference)

getReferenceString

public String getReferenceString()
Description copied from interface: DBReference
provides a meaningful (displayable) description for the referenceID/referenceType or null if there is no reference for this entry. Normally, this method would provide some cached info about the reference w/o having to dereference the link through the database. Note that this method may return null even if the reference itself is not null.

Specified by:
getReferenceString in interface DBReference


(c) Holger Antelmann since 2001- all rights reserved (contact: info@antelmann.com)
see www.antelmann.com/developer for further details and available downloads