org.nakedobjects.metamodel.runtimecontext.spec.feature
Class NakedObjectMemberAbstract

java.lang.Object
  extended by org.nakedobjects.metamodel.runtimecontext.spec.feature.NakedObjectMemberAbstract
All Implemented Interfaces:
FacetHolder, NakedObjectFeature, NakedObjectMember, Identified, NamedAndDescribed, Specification, TypedSpecification
Direct Known Subclasses:
NakedObjectActionImpl, NakedObjectAssociationAbstract

public abstract class NakedObjectMemberAbstract
extends java.lang.Object
implements NakedObjectMember


Nested Class Summary
protected static class NakedObjectMemberAbstract.MemberType
          powertype for subclasses.
 
Field Summary
protected  java.lang.String defaultName
           
 
Constructor Summary
protected NakedObjectMemberAbstract(java.lang.String id, Identified facetHolder, NakedObjectMemberAbstract.MemberType memberType, RuntimeContext runtimeContext)
           
 
Method Summary
 void addFacet(Facet facet)
          Adds the facet, extracting its type as the key.
 void addFacet(MultiTypedFacet facet)
          Adds the multi-typed facet, extracting each of its types as keys.
 boolean containsFacet(java.lang.Class<? extends Facet> facetType)
          Whether there is a facet registered of the specified type.
protected  AuthenticationSession getAuthenticationSession()
           
 java.lang.String getDescription()
          Returns a description of how the member is used - this complements the help text.
<T extends Facet>
T
getFacet(java.lang.Class<T> cls)
          Get the facet of the specified type (as per the type it reports from Facet.facetType()).
 Facet[] getFacets(Filter<Facet> filter)
          Returns all Facets matching the specified FacetFilter.
 java.lang.Class<? extends Facet>[] getFacetTypes()
          Get the list of all facet types that are supported by objects of this specification.
 java.lang.String getHelp()
          Return the help text for this member - the field or action - to complement the description.
 java.lang.String getId()
          Returns the identifier of the member, which must not change.
 Identifier getIdentifier()
          Identifier of this feature.
 java.lang.String getName()
          Return the default label for this member.
 RuntimeContext getRuntimeContext()
           
 boolean isAction()
          Whether this member represents a NakedObjectAction.
 boolean isAssociation()
          Whether this member represents a NakedObjectAssociation.
 boolean isOneToManyAssociation()
          Whether this member represents a OneToManyAssociation.
 boolean isOneToOneAssociation()
          Whether this member represents a OneToOneAssociation.
 Consent isUsable(AuthenticationSession session, NakedObject target)
          Loops over all DisablingInteractionAdvisor Facets and returns true only if none disables the member.
 Consent isVisible(AuthenticationSession session, NakedObject target)
          Loops over all HidingInteractionAdvisor Facets and returns true only if none hide the member.
 void removeFacet(java.lang.Class<? extends Facet> facetType)
          Remove the facet of the specified type.
 void removeFacet(Facet facet)
          Remove the facet whose type is that reported by Facet.facetType().
 java.lang.String toString()
           
 
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.feature.NakedObjectMember
createUsableInteractionContext, createVisibleInteractionContext, debugData
 
Methods inherited from interface org.nakedobjects.metamodel.spec.TypedSpecification
getSpecification
 
Methods inherited from interface org.nakedobjects.metamodel.spec.Specification
getInstance
 

Field Detail

defaultName

protected final java.lang.String defaultName
Constructor Detail

NakedObjectMemberAbstract

protected NakedObjectMemberAbstract(java.lang.String id,
                                    Identified facetHolder,
                                    NakedObjectMemberAbstract.MemberType memberType,
                                    RuntimeContext runtimeContext)
Method Detail

getId

public java.lang.String getId()
Description copied from interface: NakedObjectMember
Returns the identifier of the member, which must not change. This should be all camel-case with no spaces: so if the member is called 'Return Date' then the a suitable id would be 'ReturnDate'.

Specified by:
getId in interface NakedObjectMember

getIdentifier

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

Specified by:
getIdentifier in interface Identified

toString

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

containsFacet

public boolean containsFacet(java.lang.Class<? extends Facet> facetType)
Description copied from interface: FacetHolder
Whether there is a facet registered of the specified type.

Convenience; saves having to FacetHolder.getFacet(Class) and then check if null.

Specified by:
containsFacet in interface FacetHolder

getFacet

public <T extends Facet> T getFacet(java.lang.Class<T> cls)
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

getFacetTypes

public java.lang.Class<? extends Facet>[] getFacetTypes()
Description copied from interface: FacetHolder
Get the list of all facet types that are supported by objects of this specification.

Specified by:
getFacetTypes in interface FacetHolder

getFacets

public Facet[] getFacets(Filter<Facet> filter)
Description copied from interface: FacetHolder
Returns all Facets matching the specified FacetFilter.

Specified by:
getFacets in interface FacetHolder
Returns:

addFacet

public void addFacet(Facet facet)
Description copied from interface: FacetHolder
Adds the facet, extracting its type as the key.

If there are any facet of the same type, they will be overwritten provided that either the Facet specifies to always replace or if the existing Facet is a no-op.

Specified by:
addFacet in interface FacetHolder

addFacet

public void addFacet(MultiTypedFacet facet)
Description copied from interface: FacetHolder
Adds the multi-typed facet, extracting each of its types as keys.

If there are any facet of the same type, they will be overwritten provided that either the Facet specifies to always replace or if the existing Facet is a no-op.

Specified by:
addFacet in interface FacetHolder

removeFacet

public void removeFacet(Facet facet)
Description copied from interface: FacetHolder
Remove the facet whose type is that reported by Facet.facetType().

Specified by:
removeFacet in interface FacetHolder

removeFacet

public void removeFacet(java.lang.Class<? extends Facet> facetType)
Description copied from interface: FacetHolder
Remove the facet of the specified type.

Specified by:
removeFacet in interface FacetHolder

getName

public java.lang.String getName()
Return the default label for this member. This is based on the name of this member.

Specified by:
getName in interface NamedAndDescribed
See Also:
getId()

getDescription

public java.lang.String getDescription()
Description copied from interface: NamedAndDescribed
Returns a description of how the member is used - this complements the help text.

Specified by:
getDescription in interface NamedAndDescribed
See Also:
#getHelp()

getHelp

public java.lang.String getHelp()
Description copied from interface: NakedObjectMember
Return the help text for this member - the field or action - to complement the description.

Specified by:
getHelp in interface NakedObjectMember
See Also:
NamedAndDescribed.getDescription()

isVisible

public Consent isVisible(AuthenticationSession session,
                         NakedObject target)
Loops over all HidingInteractionAdvisor Facets and returns true only if none hide the member.

TODO: currently this method is hard-coded to assume all interactions are initiated by user.

Specified by:
isVisible in interface NakedObjectMember
target - may be null if just checking for authorization.
See Also:
#isVisibleResult(AuthenticationSession, NakedObject)

isUsable

public Consent isUsable(AuthenticationSession session,
                        NakedObject target)
Loops over all DisablingInteractionAdvisor Facets and returns true only if none disables the member.

TODO: currently this method is hard-coded to assume all interactions are initiated by user.

Specified by:
isUsable in interface NakedObjectMember
target - may be null if just checking for authorization.
See Also:
#isUsableResult(AuthenticationSession, NakedObject)

isAction

public boolean isAction()
Description copied from interface: NakedObjectMember
Whether this member represents a NakedObjectAction.

If so, can be safely downcast to NakedObjectAction.

Specified by:
isAction in interface NakedObjectMember

isAssociation

public boolean isAssociation()
Description copied from interface: NakedObjectMember
Whether this member represents a NakedObjectAssociation.

If so, can be safely downcast to NakedObjectAssociation.

Specified by:
isAssociation in interface NakedObjectMember

isOneToManyAssociation

public boolean isOneToManyAssociation()
Description copied from interface: NakedObjectMember
Whether this member represents a OneToManyAssociation.

If so, can be safely downcast to OneToManyAssociation.

Specified by:
isOneToManyAssociation in interface NakedObjectMember

isOneToOneAssociation

public boolean isOneToOneAssociation()
Description copied from interface: NakedObjectMember
Whether this member represents a OneToOneAssociation.

If so, can be safely downcast to OneToOneAssociation.

Specified by:
isOneToOneAssociation in interface NakedObjectMember

getRuntimeContext

public RuntimeContext getRuntimeContext()

getAuthenticationSession

protected AuthenticationSession getAuthenticationSession()


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