|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object pt.ist.fenixframework.core.AbstractDomainObject
public abstract class AbstractDomainObject
This is the top-level class for every DomainObject. Each backend should provide a subclass of
this class, with a backend-specific implementation of both DomainObject.getExternalId()
and getOid()
. In this class, they simply throw an UnsupportedOperationException
. The method DomainObject.getExternalId()
should be used
by the user of the framework, whereas the method getOid()
should be used by code within
the framework. This allows for a more efficient implementation of the object's internal
identifier, other than the String type imposed on the external identifier.
Additionally, the subclass must also implement ensureOid()
, makeSerializedForm()
, and AbstractDomainObject.SerializedForm.fromExternalId(String)
. See their
documentation for further explanation.
Nested Class Summary | |
---|---|
protected static class |
AbstractDomainObject.SerializedForm
|
Constructor Summary | |
---|---|
protected |
AbstractDomainObject()
Default, no-arg constructor. |
protected |
AbstractDomainObject(DomainObjectAllocator.OID oid)
This constructor exists only as part of the allocate-instance protocol and should never be explicitly invoked by the programmer. |
Method Summary | |
---|---|
protected void |
ensureOid()
Set the identifier ( oid ) of the object that is being created. |
boolean |
equals(Object obj)
|
String |
getExternalId()
|
Comparable |
getOid()
Returns an internal global representation of this object. |
int |
hashCode()
|
protected AbstractDomainObject.SerializedForm |
makeSerializedForm()
Creates the concrete instance of SerializedForm for this DomainObject. |
String |
toString()
|
protected Object |
writeReplace()
|
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
protected AbstractDomainObject()
ensureOid()
to set the object's identifier.
Every DomainObject
constructor (except for the special allocate-instance constructor)
should ensure that ensureOid()
is called once during object creation.
ensureOid()
protected AbstractDomainObject(DomainObjectAllocator.OID oid)
Method Detail |
---|
public String getExternalId()
getExternalId
in interface DomainObject
public Comparable getOid()
getExternalId()
, this method enables code **within** the
framework to leverage on the knowledge of the concrete identifier, thus being more efficient.
This method should only be used by code internal to the framework.
protected void ensureOid()
oid
) of the object that is being created. This method is
invoked by the no-arg constructor. It is only intented to be invoked from within a
constructor (with the exception of AbstractDomainObject(DomainObjectAllocator.OID)
,
which has its own way of restoring the object's id.
public final int hashCode()
hashCode
in class Object
public final boolean equals(Object obj)
equals
in class Object
protected Object writeReplace() throws ObjectStreamException
ObjectStreamException
protected AbstractDomainObject.SerializedForm makeSerializedForm()
public String toString()
toString
in class Object
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |