|
Naked Objects
Enriching object behavioursCreating persistent objects | |
|
Because of the way that objects are persisted within the framework
Java's Location home; home = (Location) createInstance(Location.class); Sometimes it is necessary to create non-persistent (or 'transient')
naked objects, either for use outside the shared object space or as part
of a longer creation process, where the user will place the object into
the shared space later. A transient object can be created using the
Calling Location away;
away = (Location) createTransientInstance(Location.class);
:
:
away.makePersistent();
This following method is an actual object creation example taken
from the public Location actionNewLocation() {
Location loc = (Location) createInstance(Location.class);
loc.setCity(this);
return loc;
}
As these two creation methods are available you should avoid using
the
|
|
|
Copyright (c) 2002 nakedobjects.org You may print this document for your own personal use, or you may copy it in electronic form for access within your organisation, provided this notice is preserved. | |