org.nakedobjects.object
Class AbstractNakedObject

java.lang.Object
  extended byjava.util.Observable
      extended byorg.nakedobjects.object.AbstractNakedObject
All Implemented Interfaces:
java.io.Externalizable, Naked, NakedObject, java.io.Serializable
Direct Known Subclasses:
AbstractNakedCollection, Account, Claim, Employee, Expense, NakedClass, NakedError, Payment, Project, ProjectExpenses, Receipt, Role, User

public abstract class AbstractNakedObject
extends java.util.Observable
implements NakedObject, java.io.Externalizable

See Also:
Serialized Form

Constructor Summary
AbstractNakedObject()
           
 
Method Summary
 About about()
          Return a standard READ/WRITE About, specifically: AttributeController.READ_WRITE
 About aboutExplorationActionClass()
           
 About aboutExplorationActionClone()
           
 About aboutExplorationActionMakePersistent()
           
 boolean canClone()
          Returns true if this object should be able to be cloned.
 java.lang.String contextualTitle()
          Defaults to the value passed backed from title().
 void copyObject(Naked objectToCopy)
          Copies the fields from the specified instance to the current instance.
 void created()
          hook method - fully specified in the interface
protected static NakedObject createInstance(java.lang.Class type)
          A utility method for creating new objects in the context of the system - that is, it is added to the pool of objects the enterprise system contains.
protected static NakedObject createInstance(java.lang.String typeName)
          A utility method for creating new objects in the context of the system - that is, it is added to the pool of objects the enterprise system contains.
protected static NakedObject createTransientInstance(java.lang.Class type)
          A utility method for creating new objects in the context of the system - that is, it is added to the pool of objects the enterprise system contains.
 void deleted()
          hook method, see interface description for further details
 void destroy()
          Called when a the system destoys an object - permenantly removes it from the object store.
 boolean equals(java.lang.Object obj)
          An object will be deemed to be equal if it: is this object; or has the same OID.
 NakedClass explorationActionClass()
           
 AbstractNakedObject explorationActionClone()
          Clones the current object.
 NakedError explorationActionMakePersistent()
           
static java.lang.String getClassHelpText()
          Returns null.
 java.lang.String getClassName()
          Returns the short class name looking at the getFullClassName() result and passes back all the text after the last period/dot.
 java.lang.String getCollectiveName()
          Deprecated.  
 java.lang.String getFullClassName()
          Returns the class name by getting the Class object fot this object and asks it for the name using getName()
 java.lang.String getIconName()
          Returns the String returned by getClassName()
 java.lang.String getIdString()
          The objects descriptive id for dislaying to a user.
 NakedClass getNakedClass()
          Returns the NakedClass that represents this object.
 java.lang.String getObjectHelpText()
          Returns a textual desctiption of the object - its contents and possible uses.
 NakedObjectStore getObjectStore()
           
 java.lang.Object getOid()
          The objects unique id.
 int hashCode()
           
 java.awt.Image iconImage(int size)
          Returns an Image loaded by the ImageIcon class.
static void init(NakedObjectStore objectStore)
           
 boolean isEmpty()
          Returns false indicating that the object contains data.
 boolean isFinder()
          Returns true if the object is used for finding objects.
 boolean isLookupElement(java.lang.String argument)
          Returns true if the argument is the same as the value return by toString()
 boolean isPersistent()
          Returns true if this object has an OID set.
 boolean isResolved()
          returns true when the object has been completely read into memory and all it attributes can be accessed.
 boolean isSameAs(Naked object)
          returns true if the specified object is this object, i.e. no content comparison is done.
 boolean isValid()
          By default an object is always in a valid state.
 void makeFinder()
           
 void makePersistent()
           
 void objectChanged()
          Attempts to call save in the object store.
 void readExternal(java.io.ObjectInput in)
           
 void resolve()
          Resolves the current object ensuring all its attributes are available in memory.
static void resolve(NakedObject object)
          A utiltiy method for simplifying the resolving of an objects attribute.
 void setChangedAndNotifyObservers()
          Notifies all observers of this object that it has changed.
 void setOid(java.lang.Object oid)
          Sets the OID for this object.
 void setResolved()
          sets the object's resolved state to true
 java.lang.String summary()
          Returns a String summarising the state of the object.
 Title title()
          every Naked Object is required to provide a Title by which it is identified to the end user.
 java.lang.String toString()
           
 void writeExternal(java.io.ObjectOutput out)
           
 
Methods inherited from class java.util.Observable
addObserver, clearChanged, countObservers, deleteObserver, deleteObservers, hasChanged, notifyObservers, notifyObservers, setChanged
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.nakedobjects.object.NakedObject
addObserver, countObservers, deleteObserver, hasChanged
 

Constructor Detail

AbstractNakedObject

public AbstractNakedObject()
Method Detail

getClassHelpText

public static java.lang.String getClassHelpText()
Returns null. Override with details about the class"


getClassName

public java.lang.String getClassName()
Returns the short class name looking at the getFullClassName() result and passes back all the text after the last period/dot.

Specified by:
getClassName in interface Naked

getCollectiveName

public java.lang.String getCollectiveName()
Deprecated.  

Returns the value of getClassName() concatenated with "s" (any subclass that does not work with this simple rule should override this method e.g., Money)

Specified by:
getCollectiveName in interface NakedObject

getFullClassName

public java.lang.String getFullClassName()
Returns the class name by getting the Class object fot this object and asks it for the name using getName()

Specified by:
getFullClassName in interface Naked

getIconName

public java.lang.String getIconName()
Returns the String returned by getClassName()

See Also:
getClassName()

getIdString

public java.lang.String getIdString()
Description copied from interface: NakedObject
The objects descriptive id for dislaying to a user.

Specified by:
getIdString in interface NakedObject

getNakedClass

public NakedClass getNakedClass()
Description copied from interface: NakedObject
Returns the NakedClass that represents this object.

Specified by:
getNakedClass in interface NakedObject

getObjectHelpText

public java.lang.String getObjectHelpText()
Description copied from interface: Naked
Returns a textual desctiption of the object - its contents and possible uses.

Specified by:
getObjectHelpText in interface Naked

getObjectStore

public NakedObjectStore getObjectStore()
Specified by:
getObjectStore in interface NakedObject

getOid

public java.lang.Object getOid()
Description copied from interface: NakedObject
The objects unique id. This id allows the object to added to, stored by, and retrieved from the object store.

Specified by:
getOid in interface NakedObject

about

public About about()
Return a standard READ/WRITE About, specifically: AttributeController.READ_WRITE

Specified by:
about in interface Naked

aboutExplorationActionClone

public About aboutExplorationActionClone()

aboutExplorationActionClass

public About aboutExplorationActionClass()

canClone

public boolean canClone()
Returns true if this object should be able to be cloned. Override and return false to ensure an object cannot be cloned.

Returns:
true so by default any object can be cloned

contextualTitle

public java.lang.String contextualTitle()
Defaults to the value passed backed from title().

Specified by:
contextualTitle in interface NakedObject

copyObject

public void copyObject(Naked objectToCopy)
Copies the fields from the specified instance to the current instance. Each NakedObject object reference is copied across and values for each NakedValue object are copied across to the NakedValue objects in the current instance.

Specified by:
copyObject in interface Naked

created

public void created()
hook method - fully specified in the interface

Specified by:
created in interface NakedObject

destroy

public void destroy()
             throws ObjectStoreException
Description copied from interface: NakedObject
Called when a the system destoys an object - permenantly removes it from the object store.

Specified by:
destroy in interface NakedObject
Throws:
ObjectStoreException

equals

public boolean equals(java.lang.Object obj)
An object will be deemed to be equal if it: is this object; or has the same OID.


explorationActionClass

public NakedClass explorationActionClass()

explorationActionClone

public AbstractNakedObject explorationActionClone()
Clones the current object.


explorationActionMakePersistent

public NakedError explorationActionMakePersistent()

aboutExplorationActionMakePersistent

public About aboutExplorationActionMakePersistent()

hashCode

public int hashCode()

iconImage

public java.awt.Image iconImage(int size)
Returns an Image loaded by the ImageIcon class. The image file it uses is based on the name got from getIconName(), and a status code, if the Status interface is implemented, from Status.statusCode()

Specified by:
iconImage in interface NakedObject
Parameters:
size - the image should be, in pixels
See Also:
getIconName(), Status.statusCode(), ImageIcon.getImageIcon(String, int, String)

init

public static void init(NakedObjectStore objectStore)

setChangedAndNotifyObservers

public void setChangedAndNotifyObservers()
Description copied from interface: NakedObject
Notifies all observers of this object that it has changed.

Specified by:
setChangedAndNotifyObservers in interface NakedObject

isEmpty

public boolean isEmpty()
Returns false indicating that the object contains data.

Specified by:
isEmpty in interface Naked

isFinder

public boolean isFinder()
Description copied from interface: NakedObject
Returns true if the object is used for finding objects. An object cannot be a finder object and persistent.

Specified by:
isFinder in interface NakedObject

isLookupElement

public boolean isLookupElement(java.lang.String argument)
Returns true if the argument is the same as the value return by toString()

Specified by:
isLookupElement in interface NakedObject

setOid

public void setOid(java.lang.Object oid)
Description copied from interface: NakedObject
Sets the OID for this object. This id must be unique.

Specified by:
setOid in interface NakedObject

isPersistent

public boolean isPersistent()
Returns true if this object has an OID set.

Specified by:
isPersistent in interface NakedObject

setResolved

public void setResolved()
Description copied from interface: NakedObject
sets the object's resolved state to true

Specified by:
setResolved in interface NakedObject

isResolved

public boolean isResolved()
Description copied from interface: NakedObject
returns true when the object has been completely read into memory and all it attributes can be accessed.

Specified by:
isResolved in interface NakedObject

isValid

public boolean isValid()
By default an object is always in a valid state.

Specified by:
isValid in interface Naked

makeFinder

public void makeFinder()
Specified by:
makeFinder in interface NakedObject

makePersistent

public void makePersistent()
                    throws ObjectStoreException
Specified by:
makePersistent in interface NakedObject
Throws:
ObjectStoreException

objectChanged

public void objectChanged()
Attempts to call save in the object store.

Specified by:
objectChanged in interface NakedObject

resolve

public void resolve()
Description copied from interface: NakedObject
Resolves the current object ensuring all its attributes are available in memory.

Specified by:
resolve in interface NakedObject

resolve

public static void resolve(NakedObject object)
A utiltiy method for simplifying the resolving of an objects attribute. Calls resolve() on the secified object. If the specified reference no action is done.


summary

public java.lang.String summary()
Description copied from interface: Naked
Returns a String summarising the state of the object.

Specified by:
summary in interface Naked

title

public Title title()
every Naked Object is required to provide a Title by which it is identified to the end user.

Unless overridden, the String representation of this Title object is available through contextualTitle().

Specified by:
title in interface Naked
See Also:
contextualTitle()

isSameAs

public boolean isSameAs(Naked object)
returns true if the specified object is this object, i.e. no content comparison is done.

Specified by:
isSameAs in interface Naked
Parameters:
object - the object to compare
Returns:
boolean returns true if the objects have the same content, and false if the objects are of different types or their contents are deemed to be different.
See Also:
Naked.isSameAs(Naked)

deleted

public void deleted()
hook method, see interface description for further details

Specified by:
deleted in interface NakedObject

toString

public java.lang.String toString()

createInstance

protected static NakedObject createInstance(java.lang.Class type)
A utility method for creating new objects in the context of the system - that is, it is added to the pool of objects the enterprise system contains.


createInstance

protected static NakedObject createInstance(java.lang.String typeName)
A utility method for creating new objects in the context of the system - that is, it is added to the pool of objects the enterprise system contains.

Added to support .NET implementations.


createTransientInstance

protected static NakedObject createTransientInstance(java.lang.Class type)
A utility method for creating new objects in the context of the system - that is, it is added to the pool of objects the enterprise system contains.


readExternal

public void readExternal(java.io.ObjectInput in)
                  throws java.lang.ClassNotFoundException,
                         java.io.IOException
Specified by:
readExternal in interface java.io.Externalizable
Throws:
java.lang.ClassNotFoundException
java.io.IOException

writeExternal

public void writeExternal(java.io.ObjectOutput out)
                   throws java.io.IOException
Specified by:
writeExternal in interface java.io.Externalizable
Throws:
java.io.IOException