org.nakedobjects.metamodel.runtimecontext.spec
Class IntrospectableSpecificationAbstract

java.lang.Object
  extended by org.nakedobjects.metamodel.facets.FacetHolderImpl
      extended by org.nakedobjects.metamodel.runtimecontext.spec.IntrospectableSpecificationAbstract
All Implemented Interfaces:
FacetHolder, DefaultProvider, Dirtiable, NakedObjectActionContainer, NakedObjectAssociationContainer, Hierarchical, Identified, IntrospectableSpecification, NakedObjectSpecification, Specification
Direct Known Subclasses:
InstanceCollectionSpecification, JavaSpecification, NakedObjectSpecificationNoMember

public abstract class IntrospectableSpecificationAbstract
extends FacetHolderImpl
implements NakedObjectSpecification, IntrospectableSpecification


Nested Class Summary
 
Nested classes/interfaces inherited from interface org.nakedobjects.metamodel.spec.NakedObjectSpecification
NakedObjectSpecification.CreationMode
 
Field Summary
protected  NakedObjectAssociation[] fields
           
protected  java.lang.String fullName
           
protected  Identifier identifier
           
protected  NakedObjectAction[] objectActions
           
protected  NakedObjectSpecification superClassSpecification
           
 
Constructor Summary
IntrospectableSpecificationAbstract(RuntimeContext runtimeContext)
           
 
Method Summary
 void addSubclass(NakedObjectSpecification specification)
          Add the class for the specified specification as a subclass of this specification's class.
 void clearDirty(NakedObject object)
          Clear the dirty flag so that a call to isDirty(), and before markDirty() is called, will return false;
 java.lang.Object createObject(NakedObjectSpecification.CreationMode creationMode)
          Create and optionally initialize object.
 ObjectTitleContext createTitleInteractionContext(AuthenticationSession session, InteractionInvocationMethod interactionMethod, NakedObject targetNakedObject)
          Create an InteractionContext representing an attempt to read the object's title.
 ObjectValidityContext createValidityInteractionContext(AuthenticationSession session, InteractionInvocationMethod interactionMethod, NakedObject targetNakedObject)
          Create an InteractionContext representing an attempt to save the object.
protected  NakedObjectAction[] getActions(NakedObjectAction[] availableActions, NakedObjectActionType type)
           
 java.util.List<? extends NakedObjectAssociation> getAssociationList()
          As per NakedObjectAssociationContainer.getAssociations(), but returning a List.
 java.util.List<? extends NakedObjectAssociation> getAssociationList(Filter<NakedObjectAssociation> filter)
          As per NakedObjectAssociationContainer.getAssociations(Filter), but returning a List.
 NakedObjectAssociation[] getAssociations()
          Return all the fields that exist in an object of this specification, although they need not all be accessible or visible.
 NakedObjectAssociation[] getAssociations(Filter<NakedObjectAssociation> filter)
          Return all NakedObjectAssociations matching the supplied filter.
protected  AuthenticationSession getAuthenticationSession()
          Derived from runtime context.
 java.util.List<OneToManyAssociation> getCollectionList()
          All associations that represents collections.
 java.lang.Object getDefaultValue()
          Default value to be provided for properties or parameters that are not declared as @Optional but where the UI has not (yet) provided a value.
<Q extends Facet>
Q
getFacet(java.lang.Class<Q> facetType)
          Get the facet of the specified type (as per the type it reports from Facet.facetType()).
 java.lang.String getFullName()
          Returns the name of this specification.
 java.lang.String getIconName(NakedObject object)
          Returns the name of an icon to use for the specified object.
 Identifier getIdentifier()
          Identifier of this feature.
 Instance getInstance(NakedObject nakedObject)
          Return an Instance of this Specification with respect to the provided NakedObject.
 java.util.List<? extends NakedObjectAction> getObjectActionList(NakedObjectActionType... types)
          As per #getObjectActions(NakedObjectActionType), but returned as a List.
 NakedObjectAction[] getObjectActions(NakedObjectActionType... types)
          Returns an array of actions of the specified type(s).
 java.util.List<OneToOneAssociation> getPropertyList()
          All associations that represent properties.
 RuntimeContext getRuntimeContext()
           
protected  NakedObjectAction[] getServiceActions(NakedObjectActionType type)
          Finds all service actions of the specified type, if any.
 NakedObjectAction[] getServiceActionsFor(NakedObjectActionType type)
          TODO: convert to relatedResourceActions
 boolean hasSubclasses()
          Returns true if the subclasses() method will return an array of one or more elements (ie, not an empty array).
 NakedObjectSpecification[] interfaces()
          Get the list of specifications for all the interfaces that the class represented by this specification implements.
 boolean isAbstract()
           
 boolean isCollection()
          Determines if objects represents a collection.
 boolean isCollectionOrIsAggregated()
          Whether objects of this type are a collection or are intrinsically aggregated.
 boolean isDirty(NakedObject object)
          Checks if the specified object has been changed, and hence needs persisting.
 boolean isEncodeable()
          Determines if objects of this type can be converted to a data-stream.
 boolean isFinal()
          Whether or not this specification's class is marked as final, that is it may not have subclasses, and hence methods that could be overridden.
 boolean isImmutable()
          Whether has the ImmutableFacet.
 boolean isIntrospected()
           
 boolean isObject()
          Determines if the object represents an object (value or otherwise).
 boolean isOfType(NakedObjectSpecification specification)
          Determines if this specification represents the same specification, or a subclass, of the specified specification.
 boolean isParseable()
          Determines if objects of this type can be set up from a text entry string.
 boolean isService()
           
 Consent isValid(NakedObject inObject)
          Determines whether the specified object is in a valid state (for example, so can be persisted); represented as a Consent.
 InteractionResult isValidResult(NakedObject targetNakedObject)
          TODO: currently this method is hard-coded to assume all interactions are initiated by user.
 boolean isValueOrIsAggregated()
          Determines if objects of this type are aggregated.
 void markDirty(NakedObject object)
          Mark the specified object as having been changed, and hence needing persisting.
 Persistability persistability()
          Determines if objects of this specification can be persisted or not.
protected  void setIntrospected(boolean introspected)
           
 NakedObjectSpecification[] subclasses()
          Get the list of specifications for the subclasses of the class represented by this specification
 NakedObjectSpecification superclass()
          Get the specification for this specification's class's superclass.
 java.lang.String toString()
           
 
Methods inherited from class org.nakedobjects.metamodel.facets.FacetHolderImpl
addFacet, addFacet, containsFacet, getFacets, getFacetTypes, removeFacet, removeFacet
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.nakedobjects.metamodel.spec.NakedObjectSpecification
getDescription, getPluralName, getShortName, getSingularName, getTitle
 
Methods inherited from interface org.nakedobjects.metamodel.facets.FacetHolder
addFacet, addFacet, containsFacet, getFacets, getFacetTypes, removeFacet, removeFacet
 
Methods inherited from interface org.nakedobjects.metamodel.spec.feature.NakedObjectActionContainer
getObjectAction, getObjectAction
 
Methods inherited from interface org.nakedobjects.metamodel.spec.feature.NakedObjectAssociationContainer
getAssociation
 
Methods inherited from interface org.nakedobjects.metamodel.spec.IntrospectableSpecification
introspect, markAsService
 

Field Detail

fullName

protected java.lang.String fullName

fields

protected NakedObjectAssociation[] fields

objectActions

protected NakedObjectAction[] objectActions

superClassSpecification

protected NakedObjectSpecification superClassSpecification

identifier

protected Identifier identifier
Constructor Detail

IntrospectableSpecificationAbstract

public IntrospectableSpecificationAbstract(RuntimeContext runtimeContext)
Method Detail

getFullName

public java.lang.String getFullName()
Description copied from interface: NakedObjectSpecification
Returns the name of this specification. This will be the fully qualified name of the Class object that this object represents (i.e. it includes the package name).

Specified by:
getFullName in interface NakedObjectSpecification

getIconName

public java.lang.String getIconName(NakedObject object)
Description copied from interface: NakedObjectSpecification
Returns the name of an icon to use for the specified object.

Specified by:
getIconName in interface NakedObjectSpecification

hasSubclasses

public boolean hasSubclasses()
Description copied from interface: Hierarchical
Returns true if the subclasses() method will return an array of one or more elements (ie, not an empty array).

Specified by:
hasSubclasses in interface Hierarchical

interfaces

public NakedObjectSpecification[] interfaces()
Description copied from interface: Hierarchical
Get the list of specifications for all the interfaces that the class represented by this specification implements.

Specified by:
interfaces in interface Hierarchical

subclasses

public NakedObjectSpecification[] subclasses()
Description copied from interface: Hierarchical
Get the list of specifications for the subclasses of the class represented by this specification

Specified by:
subclasses in interface Hierarchical

superclass

public NakedObjectSpecification superclass()
Description copied from interface: Hierarchical
Get the specification for this specification's class's superclass.

Specified by:
superclass in interface Hierarchical

isOfType

public boolean isOfType(NakedObjectSpecification specification)
Description copied from interface: Hierarchical
Determines if this specification represents the same specification, or a subclass, of the specified specification.

subSpec.isOfType(superSpec) is equivalent to Java's superType.isAssignableFrom(subType).

Specified by:
isOfType in interface Hierarchical

addSubclass

public void addSubclass(NakedObjectSpecification specification)
Description copied from interface: Hierarchical
Add the class for the specified specification as a subclass of this specification's class.

Specified by:
addSubclass in interface Hierarchical

getInstance

public Instance getInstance(NakedObject nakedObject)
Description copied from interface: Specification
Return an Instance of this Specification with respect to the provided NakedObject.

For example, if the Specification is a OneToOneAssociation, then is an Instance implementation representing the { NakedObject/ OneToOneAssociation } tuple.

Implementations are expected to use a double-dispatch back to the provided NakedObject (passing themselves as a parameter), using NakedObjectMM.getInstance(Specification).

Note: this method may throw an UnsupportedOperationException; see NakedObjectMM.getInstance(Specification) for details.

Specified by:
getInstance in interface Specification

setIntrospected

protected void setIntrospected(boolean introspected)

isIntrospected

public boolean isIntrospected()
Specified by:
isIntrospected in interface IntrospectableSpecification

getFacet

public <Q extends Facet> Q getFacet(java.lang.Class<Q> facetType)
Description copied from interface: FacetHolder
Get the facet of the specified type (as per the type it reports from Facet.facetType()).

Specified by:
getFacet in interface FacetHolder
Overrides:
getFacet in class FacetHolderImpl

getDefaultValue

public java.lang.Object getDefaultValue()
Description copied from interface: DefaultProvider
Default value to be provided for properties or parameters that are not declared as @Optional but where the UI has not (yet) provided a value.

Specified by:
getDefaultValue in interface DefaultProvider

getIdentifier

public Identifier getIdentifier()
Description copied from interface: Identified
Identifier of this feature.

Specified by:
getIdentifier in interface Identified

createTitleInteractionContext

public ObjectTitleContext createTitleInteractionContext(AuthenticationSession session,
                                                        InteractionInvocationMethod interactionMethod,
                                                        NakedObject targetNakedObject)
Description copied from interface: NakedObjectSpecification
Create an InteractionContext representing an attempt to read the object's title.

Specified by:
createTitleInteractionContext in interface NakedObjectSpecification

getAssociations

public NakedObjectAssociation[] getAssociations()
Description copied from interface: NakedObjectAssociationContainer
Return all the fields that exist in an object of this specification, although they need not all be accessible or visible.

Specified by:
getAssociations in interface NakedObjectAssociationContainer

getAssociationList

public java.util.List<? extends NakedObjectAssociation> getAssociationList()
Description copied from interface: NakedObjectAssociationContainer
As per NakedObjectAssociationContainer.getAssociations(), but returning a List.

Specified by:
getAssociationList in interface NakedObjectAssociationContainer
Returns:

getAssociations

public NakedObjectAssociation[] getAssociations(Filter<NakedObjectAssociation> filter)
Description copied from interface: NakedObjectAssociationContainer
Return all NakedObjectAssociations matching the supplied filter. To get the statically visible fields (where any invisible and unauthorised fields have been removed) use NakedObjectAssociationFilters#STATICALLY_VISIBLE_ASSOCIATIONS

Specified by:
getAssociations in interface NakedObjectAssociationContainer
See Also:
Filters

getAssociationList

public java.util.List<? extends NakedObjectAssociation> getAssociationList(Filter<NakedObjectAssociation> filter)
Description copied from interface: NakedObjectAssociationContainer
As per NakedObjectAssociationContainer.getAssociations(Filter), but returning a List.

Specified by:
getAssociationList in interface NakedObjectAssociationContainer
Returns:

getPropertyList

public java.util.List<OneToOneAssociation> getPropertyList()
Description copied from interface: NakedObjectAssociationContainer
All associations that represent properties.

Specified by:
getPropertyList in interface NakedObjectAssociationContainer

getCollectionList

public java.util.List<OneToManyAssociation> getCollectionList()
Description copied from interface: NakedObjectAssociationContainer
All associations that represents collections.

Specified by:
getCollectionList in interface NakedObjectAssociationContainer
Returns:

getActions

protected NakedObjectAction[] getActions(NakedObjectAction[] availableActions,
                                         NakedObjectActionType type)

getObjectActions

public NakedObjectAction[] getObjectActions(NakedObjectActionType... types)
Description copied from interface: NakedObjectActionContainer
Returns an array of actions of the specified type(s).

If the type is null, then returns all user, exploration and debug actions (but not action sets).

Specified by:
getObjectActions in interface NakedObjectActionContainer

getObjectActionList

public java.util.List<? extends NakedObjectAction> getObjectActionList(NakedObjectActionType... types)
Description copied from interface: NakedObjectActionContainer
As per #getObjectActions(NakedObjectActionType), but returned as a List.

Specified by:
getObjectActionList in interface NakedObjectActionContainer

getServiceActionsFor

public NakedObjectAction[] getServiceActionsFor(NakedObjectActionType type)
Description copied from interface: NakedObjectActionContainer
TODO: convert to relatedResourceActions

Specified by:
getServiceActionsFor in interface NakedObjectActionContainer

isAbstract

public boolean isAbstract()
Specified by:
isAbstract in interface NakedObjectSpecification

isFinal

public boolean isFinal()
Whether or not this specification's class is marked as final, that is it may not have subclasses, and hence methods that could be overridden.

Note - not used at present.


isService

public boolean isService()
Specified by:
isService in interface NakedObjectSpecification

isDirty

public boolean isDirty(NakedObject object)
Description copied from interface: Dirtiable
Checks if the specified object has been changed, and hence needs persisting.

Specified by:
isDirty in interface Dirtiable
See Also:
Dirtiable.markDirty(NakedObject), Dirtiable.clearDirty(NakedObject)

clearDirty

public void clearDirty(NakedObject object)
Description copied from interface: Dirtiable
Clear the dirty flag so that a call to isDirty(), and before markDirty() is called, will return false;

Specified by:
clearDirty in interface Dirtiable
See Also:
Dirtiable.isDirty(NakedObject), Dirtiable.markDirty(NakedObject)

markDirty

public void markDirty(NakedObject object)
Description copied from interface: Dirtiable
Mark the specified object as having been changed, and hence needing persisting.

Specified by:
markDirty in interface Dirtiable
See Also:
Dirtiable.isDirty(NakedObject), Dirtiable.clearDirty(NakedObject)

getServiceActions

protected NakedObjectAction[] getServiceActions(NakedObjectActionType type)
Finds all service actions of the specified type, if any.

However, if this specification is actually for a service, then returns an empty array.

Returns:
an array of NakedObjectActionSets (!!), each of which contains NakedObjectActions of the requested type.

isValid

public Consent isValid(NakedObject inObject)
Description copied from interface: NakedObjectSpecification
Determines whether the specified object is in a valid state (for example, so can be persisted); represented as a Consent.

Specified by:
isValid in interface NakedObjectSpecification

isValidResult

public InteractionResult isValidResult(NakedObject targetNakedObject)
TODO: currently this method is hard-coded to assume all interactions are initiated by user.

Specified by:
isValidResult in interface NakedObjectSpecification

createValidityInteractionContext

public ObjectValidityContext createValidityInteractionContext(AuthenticationSession session,
                                                              InteractionInvocationMethod interactionMethod,
                                                              NakedObject targetNakedObject)
Create an InteractionContext representing an attempt to save the object.

Specified by:
createValidityInteractionContext in interface NakedObjectSpecification

persistability

public Persistability persistability()
Description copied from interface: NakedObjectSpecification
Determines if objects of this specification can be persisted or not. If it can be persisted (i.e. it return something other than Persistability.TRANSIENT NakedObject.isPersistent() will indicated whether the object is persistent or not. If they cannot be persisted then NakedObject. NakedObjectSpecification.persistability() should be ignored.

Specified by:
persistability in interface NakedObjectSpecification

isParseable

public boolean isParseable()
Description copied from interface: NakedObjectSpecification
Determines if objects of this type can be set up from a text entry string.

In effect, means has got a ParseableFacet.

Specified by:
isParseable in interface NakedObjectSpecification

isEncodeable

public boolean isEncodeable()
Description copied from interface: NakedObjectSpecification
Determines if objects of this type can be converted to a data-stream.

In effect, means has got EncodableFacet.

Specified by:
isEncodeable in interface NakedObjectSpecification

isValueOrIsAggregated

public boolean isValueOrIsAggregated()
Description copied from interface: NakedObjectSpecification
Determines if objects of this type are aggregated.

In effect, means has got AggregatedFacet or ValueFacet.

Specified by:
isValueOrIsAggregated in interface NakedObjectSpecification

isCollection

public boolean isCollection()
Description copied from interface: NakedObjectSpecification
Determines if objects represents a collection.

In effect, means has got CollectionFacet, and therefore will return NOT NakedObjectSpecification.isObject().

Specified by:
isCollection in interface NakedObjectSpecification
See Also:
NakedObjectSpecification.isObject()

isObject

public boolean isObject()
Description copied from interface: NakedObjectSpecification
Determines if the object represents an object (value or otherwise).

In effect, means that it doesn't have the CollectionFacet, and therefore will return NOT NakedObjectSpecification.isCollection()

Specified by:
isObject in interface NakedObjectSpecification
See Also:
NakedObjectSpecification.isCollection().

isImmutable

public boolean isImmutable()
Description copied from interface: NakedObjectSpecification
Whether has the ImmutableFacet.

Specified by:
isImmutable in interface NakedObjectSpecification

isCollectionOrIsAggregated

public boolean isCollectionOrIsAggregated()
Description copied from interface: NakedObjectSpecification
Whether objects of this type are a collection or are intrinsically aggregated.

In effect, means has got a CollectionFacet and/or got the AggregatedFacet.

Specified by:
isCollectionOrIsAggregated in interface NakedObjectSpecification

createObject

public java.lang.Object createObject(NakedObjectSpecification.CreationMode creationMode)
Description copied from interface: NakedObjectSpecification
Create and optionally initialize object.

Specified by:
createObject in interface NakedObjectSpecification

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

getRuntimeContext

public RuntimeContext getRuntimeContext()

getAuthenticationSession

protected final AuthenticationSession getAuthenticationSession()
Derived from runtime context.



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