org.nakedobjects.applib
Class AbstractContainedObject

java.lang.Object
  extended by org.nakedobjects.applib.AbstractContainedObject
Direct Known Subclasses:
AbstractDomainObject, AbstractFixture, AbstractService

public abstract class AbstractContainedObject
extends Object

Convenience super class for all classes that wish to interact with the container.

See Also:
DomainObjectContainer

Constructor Summary
AbstractContainedObject()
           
 
Method Summary
protected
<T> List<T>
allInstances(Class<T> ofType)
          Convenience method that delegates to DomainObjectContainer.
protected
<T> List<T>
allMatches(Class<T> ofType, Filter<T> filter)
          Convenience method that delegates to DomainObjectContainer.
protected
<T> List<T>
allMatches(Class<T> ofType, String title)
          Convenience method that delegates to DomainObjectContainer.
protected
<T> List<T>
allMatches(Class<T> ofType, T pattern)
          Convenience method that delegates to DomainObjectContainer.
protected
<T> List<T>
allMatches(Query<T> query)
          Convenience method that delegates to DomainObjectContainer.
protected
<T> T
firstMatch(Class<T> ofType, Filter<T> filter)
          Convenience method that delegates to DomainObjectContainer.
protected
<T> T
firstMatch(Class<T> ofType, String title)
          Convenience method that delegates to DomainObjectContainer.
protected
<T> T
firstMatch(Class<T> ofType, T pattern)
          Convenience method that delegates to DomainObjectContainer.
protected
<T> T
firstMatch(Query<T> query)
          Convenience method that delegates to DomainObjectContainer.
protected  DomainObjectContainer getContainer()
          This field is not persisted, nor displayed to the user.
protected  UserMemento getUser()
           
protected  void informUser(String message)
          Display the specified message to the user, in a non-intrusive fashion.
protected  boolean isPersistent(Object domainObject)
          Whether the provided object is persistent.
protected  boolean isValid(Object domainObject)
          Convenience methods that delegates to DomainObjectContainer.
protected
<T> T
newTransientInstance(Class<T> ofType)
           
protected  void persist(Object transientDomainObject)
          Save provided object to the persistent object store.
protected  void persistIfNotAlready(Object domainObject)
          Saves the object, but only if not already persistent.
protected  void raiseError(String message)
          Display the specified message as an error to the user, ensuring that it is acknowledged.
protected  void remove(Object persistentDomainObject)
          Delete the provided object from the persistent object store.
 void setContainer(DomainObjectContainer container)
          Injected by the application container itself.
protected
<T> T
uniqueMatch(Class<T> ofType, Filter<T> filter)
          Convenience method that delegates to DomainObjectContainer.
protected
<T> T
uniqueMatch(Class<T> ofType, String title)
          Convenience method that delegates to DomainObjectContainer.
protected
<T> T
uniqueMatch(Class<T> ofType, T pattern)
          Convenience method that delegates to DomainObjectContainer.
protected
<T> T
uniqueMatch(Query<T> query)
          Convenience method that delegates to DomainObjectContainer.
protected  String validate(Object domainObject)
          Convenience methods that delegates to DomainObjectContainer.
protected  void warnUser(String message)
          Display the specified message as a warning to the user, in a more visible fashion, but without requiring explicit acknowledgement.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AbstractContainedObject

public AbstractContainedObject()
Method Detail

newTransientInstance

protected <T> T newTransientInstance(Class<T> ofType)

allInstances

protected <T> List<T> allInstances(Class<T> ofType)
Convenience method that delegates to DomainObjectContainer.

See Also:
DomainObjectContainer.allInstances(Class)

allMatches

protected <T> List<T> allMatches(Class<T> ofType,
                                 Filter<T> filter)
Convenience method that delegates to DomainObjectContainer.

See Also:
DomainObjectContainer.allMatches(Class, Filter)

allMatches

protected <T> List<T> allMatches(Class<T> ofType,
                                 T pattern)
Convenience method that delegates to DomainObjectContainer.

See Also:
DomainObjectContainer.allMatches(Class, Object)

allMatches

protected <T> List<T> allMatches(Class<T> ofType,
                                 String title)
Convenience method that delegates to DomainObjectContainer.

See Also:
DomainObjectContainer.allMatches(Class, String)

allMatches

protected <T> List<T> allMatches(Query<T> query)
Convenience method that delegates to DomainObjectContainer.

See Also:
DomainObjectContainer.allMatches(Query)

firstMatch

protected <T> T firstMatch(Class<T> ofType,
                           Filter<T> filter)
Convenience method that delegates to DomainObjectContainer.

See Also:
DomainObjectContainer.firstMatch(Class, Filter)

firstMatch

protected <T> T firstMatch(Class<T> ofType,
                           T pattern)
Convenience method that delegates to DomainObjectContainer.

See Also:
DomainObjectContainer.firstMatch(Class, Object)

firstMatch

protected <T> T firstMatch(Class<T> ofType,
                           String title)
Convenience method that delegates to DomainObjectContainer.

See Also:
DomainObjectContainer.firstMatch(Class, String)

firstMatch

protected <T> T firstMatch(Query<T> query)
Convenience method that delegates to DomainObjectContainer.

See Also:
DomainObjectContainer.firstMatch(Query)

uniqueMatch

protected <T> T uniqueMatch(Class<T> ofType,
                            Filter<T> filter)
Convenience method that delegates to DomainObjectContainer.

See Also:
DomainObjectContainer.uniqueMatch(Class, Filter)

uniqueMatch

protected <T> T uniqueMatch(Class<T> ofType,
                            String title)
Convenience method that delegates to DomainObjectContainer.

See Also:
DomainObjectContainer.uniqueMatch(Class, String)

uniqueMatch

protected <T> T uniqueMatch(Class<T> ofType,
                            T pattern)
Convenience method that delegates to DomainObjectContainer.

See Also:
DomainObjectContainer.uniqueMatch(Class, Object)

uniqueMatch

protected <T> T uniqueMatch(Query<T> query)
Convenience method that delegates to DomainObjectContainer.

See Also:
DomainObjectContainer.uniqueMatch(Query)

isValid

protected boolean isValid(Object domainObject)
Convenience methods that delegates to DomainObjectContainer.

See Also:
DomainObjectContainer.isValid(Object)

validate

protected String validate(Object domainObject)
Convenience methods that delegates to DomainObjectContainer.

See Also:
DomainObjectContainer.validate(Object)

isPersistent

protected boolean isPersistent(Object domainObject)
Whether the provided object is persistent.


persist

protected void persist(Object transientDomainObject)
Save provided object to the persistent object store.

If the object is persistent already, then will throw an exception.

See Also:
persistIfNotAlready(Object)

persistIfNotAlready

protected void persistIfNotAlready(Object domainObject)
Saves the object, but only if not already persistent.

See Also:
#isPersistent(), persist(Object)

remove

protected void remove(Object persistentDomainObject)
Delete the provided object from the persistent object store.


informUser

protected void informUser(String message)
Display the specified message to the user, in a non-intrusive fashion.


warnUser

protected void warnUser(String message)
Display the specified message as a warning to the user, in a more visible fashion, but without requiring explicit acknowledgement.


raiseError

protected void raiseError(String message)
Display the specified message as an error to the user, ensuring that it is acknowledged.


getUser

protected UserMemento getUser()

getContainer

protected DomainObjectContainer getContainer()
This field is not persisted, nor displayed to the user.


setContainer

public final void setContainer(DomainObjectContainer container)
Injected by the application container itself.



Copyright © 2001-2009 Naked Objects Group Ltd.. All Rights Reserved.