org.nakedobjects.metamodel.adapter
Interface NakedObjectMM

All Superinterfaces:
Instance
All Known Subinterfaces:
NakedObject

public interface NakedObjectMM
extends Instance

Naked objects are adapters to domain objects, where the application is written in terms of domain objects and those objects are represented within the NOF through these adapter, and not directly.

This interface defines just those aspects of the adapter that are of interest to the meta-model (hence the 'MM' suffix), while the NakedObject subtype defines additional properties used by the framework (PersistenceSessions et al) for tracking the persistence state of the object. In theory it ought to be possible to move NakedObject interface out of the metamodel module. However, this would require either lots of genericizing or lots of downcasting to ensure that the framework is only ever handed or deals with the NakedObjects.

See Also:
NakedObject

Method Summary
 Instance getInstance(Specification specification)
          Return an Instance of the specified Specification with respect to this NakedObject.
 java.lang.Object getObject()
          Returns the adapted domain object, the POJO, that this adapter represents with the NOF.
 NakedObjectSpecification getSpecification()
          Refines Instance.getSpecification().
 TypeOfFacet getTypeOfFacet()
          Gets the type of facet for this object, defaulting to the facet held by the underlying specification.
 boolean isPersistent()
          Whether the object is persisted.
 boolean isTransient()
          Whether the object is transient.
 void replacePojo(java.lang.Object pojo)
          Sometimes it is necessary to manage the replacement of the underlying domain object (by another component such as an object store).
 void setTypeOfFacet(TypeOfFacet typeOfFacet)
          Sets the element type facet, typically by copying it from the method or association information.
 java.lang.String titleString()
          Returns the title to display this object with, which is usually got from the wrapped domain object.
 
Methods inherited from interface org.nakedobjects.metamodel.adapter.Instance
getOwner
 

Method Detail

getSpecification

NakedObjectSpecification getSpecification()
Refines Instance.getSpecification().

Specified by:
getSpecification in interface Instance

getObject

java.lang.Object getObject()
Returns the adapted domain object, the POJO, that this adapter represents with the NOF.


titleString

java.lang.String titleString()
Returns the title to display this object with, which is usually got from the wrapped domain object.


getInstance

Instance getInstance(Specification specification)
Return an Instance of the specified Specification with respect to this NakedObject.

If called with NakedObjectSpecification, then just returns this). If called for other subinterfaces, then should provide an appropriate Instance implementation.

Designed to be called in a double-dispatch design from Specification.getInstance(NakedObject).

Note: this method will throw an UnsupportedOperationException unless the extended PojoAdapterXFactory is configured. (That is, only PojoAdapterX provides support for this; the regular PojoAdapter does not currently.

Parameters:
nakedObject -
Returns:

isPersistent

boolean isPersistent()
Whether the object is persisted.

Note: not necessarily the reciprocal of isTransient(); standalone adapters (with ResolveState.VALUE) report as neither persistent or transient.


isTransient

boolean isTransient()
Whether the object is transient.

Note: not necessarily the reciprocal of isPersistent(); standalone adapters (with ResolveState.VALUE) report as neither persistent or transient.


replacePojo

void replacePojo(java.lang.Object pojo)
Sometimes it is necessary to manage the replacement of the underlying domain object (by another component such as an object store). This method allows the adapter to be kept while the domain object is replaced.


getTypeOfFacet

TypeOfFacet getTypeOfFacet()
Gets the type of facet for this object, defaulting to the facet held by the underlying specification. This is needed by collections that can have an element type but is not held by the collection, such as generic collections that lose the type information through type erasure. REVIEW should this and the setTypeOfFacet(TypeOfFacet) be more generic allowing other facets to be added to adapters.


setTypeOfFacet

void setTypeOfFacet(TypeOfFacet typeOfFacet)
Sets the element type facet, typically by copying it from the method or association information.

See Also:
getTypeOfFacet()


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