org.nakedobjects.metamodel.facets
Class FacetAbstract

java.lang.Object
  extended by org.nakedobjects.metamodel.facets.FacetAbstract
All Implemented Interfaces:
Facet
Direct Known Subclasses:
ActionChoicesFacetAbstract, ActionDefaultsFacetAbstract, ActionInvocationFacetAbstract, ActionParameterChoicesFacetAbstract, ActionParameterDefaultsFacetAbstract, ActionValidationFacetAbstract, CallbackFacetAbstract, CollectionAddToFacetAbstract, CollectionClearFacetAbstract, CollectionFacetAbstract, CollectionRemoveFromFacetAbstract, CollectionValidateAddToFacetAbstract, CollectionValidateRemoveFromFacetAbstract, DefaultedFacetAbstract, DefaultedFacetUsingDefaultsProvider, DirtyObjectFacetAbstract, DisableForContextFacetAbstract, DisableForSessionFacetAbstract, EncodableFacetAbstract, EncodableFacetUsingEncoderDecoder, FacetsFacetAbstract, HideForContextFacetAbstract, HideForSessionFacetAbstract, IconFacetAbstract, MarkerFacetAbstract, MultipleValueFacetAbstract, MultiTypedFacetAbstract, MustSatisfySpecificationFacet, ObjectValidPropertiesFacetAbstract, ParseableFacetAbstract, ParseableFacetUsingParser, PropertyAccessorFacetAbstract, PropertyChoicesFacetAbstract, PropertyClearFacetAbstract, PropertyDefaultFacetAbstract, PropertyDefaultFacetDerivedFromDefaultedFacet, PropertyInitializationFacetAbstract, PropertySetterFacetAbstract, PropertyValidateFacetAbstract, PropertyValidateFacetDefault, SingleClassValueFacetAbstract, SingleIntValueFacetAbstract, SingleStringValueFacetAbstract, SingleValueFacetAbstract, SingleWhenValueFacetAbstract, TitleFacetAbstract, TitleFacetUsingParser, TypicalLengthFacetAbstract, TypicalLengthFacetUsingParser, ValidateObjectFacetAbstract, ValueSemanticsProviderAbstract

public abstract class FacetAbstract
extends java.lang.Object
implements Facet


Constructor Summary
FacetAbstract(java.lang.Class<? extends Facet> facetType, FacetHolder holder, boolean derived)
           
 
Method Summary
 boolean alwaysReplace()
          Default implementation of this method that returns true, ie should replace (none no-op implementations.
 java.lang.Class<? extends Facet> facetType()
          Determines the type of this facet to be stored under.
 FacetHolder getFacetHolder()
          The holder of this facet.
 Identified getIdentified()
          Convenience method that returns getFacetHolder() downcast to Identified if the implementation does indeed inherit from Identified, otherwise null.
 Facet getUnderlyingFacet()
          Underlying Facet of the same type, if any.
 boolean isDerived()
          Whether this facet implementation is derived (as opposed to explicit); used to determine precedence.
 boolean isNoop()
          Assume implementation is not a no-op.
 void setFacetHolder(FacetHolder facetHolder)
          Allows reparenting of Facet.
 void setUnderlyingFacet(Facet underlyingFacet)
          Sets underlying Facet, that is, creating a chain.
 java.lang.String toString()
           
protected  java.lang.String toStringValues()
           
 java.lang.Object unwrapObject(NakedObject nakedObject)
          For convenience of subclass facets that implement ValidatingInteractionAdvisor, HidingInteractionAdvisor or DisablingInteractionAdvisor.
 java.lang.String unwrapString(NakedObject nakedObject)
          For convenience of subclass facets that implement ValidatingInteractionAdvisor, HidingInteractionAdvisor or DisablingInteractionAdvisor.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

FacetAbstract

public FacetAbstract(java.lang.Class<? extends Facet> facetType,
                     FacetHolder holder,
                     boolean derived)
Method Detail

facetType

public final java.lang.Class<? extends Facet> facetType()
Description copied from interface: Facet
Determines the type of this facet to be stored under.

The framework looks for Facets of certain well-known facet types. Each facet implementation must specify which type of facet it corresponds to. This therefore allows the (rules of the) programming model to be varied without impacting the rest of the framework.

For example, the ActionInvocationFacet specifies the facet to invoke an action. The typical implementation of this wraps a public method. However, a different facet factory could be installed that creates facet also of type ActionInvocationFacet but that have some other rule, such as requiring an action prefix, or that decorate the interaction by logging it, for example.

Specified by:
facetType in interface Facet

getFacetHolder

public FacetHolder getFacetHolder()
Description copied from interface: Facet
The holder of this facet.

Specified by:
getFacetHolder in interface Facet
Returns:

isDerived

public boolean isDerived()
Description copied from interface: Facet
Whether this facet implementation is derived (as opposed to explicit); used to determine precedence.

For example, we might derive the typical length of a property based on its type; but if the typical length has been explicitly specified using an annotation then that should take precedence.

Specified by:
isDerived in interface Facet

getIdentified

public Identified getIdentified()
Convenience method that returns getFacetHolder() downcast to Identified if the implementation does indeed inherit from Identified, otherwise null.


getUnderlyingFacet

public Facet getUnderlyingFacet()
Description copied from interface: Facet
Underlying Facet of the same type, if any.

Specified by:
getUnderlyingFacet in interface Facet

setUnderlyingFacet

public void setUnderlyingFacet(Facet underlyingFacet)
Description copied from interface: Facet
Sets underlying Facet, that is, creating a chain.

Must be of the same type.

Specified by:
setUnderlyingFacet in interface Facet

isNoop

public boolean isNoop()
Assume implementation is not a no-op.

No-op implementations should override and return true.

Specified by:
isNoop in interface Facet

alwaysReplace

public boolean alwaysReplace()
Default implementation of this method that returns true, ie should replace (none no-op implementations.

Implementations that don't wish to replace none no-op implementations should override and return false.

Specified by:
alwaysReplace in interface Facet

setFacetHolder

public void setFacetHolder(FacetHolder facetHolder)
Description copied from interface: Facet
Allows reparenting of Facet.

Used by Facet decorators.

Specified by:
setFacetHolder in interface Facet

toString

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

unwrapObject

public java.lang.Object unwrapObject(NakedObject nakedObject)
For convenience of subclass facets that implement ValidatingInteractionAdvisor, HidingInteractionAdvisor or DisablingInteractionAdvisor.


unwrapString

public java.lang.String unwrapString(NakedObject nakedObject)
For convenience of subclass facets that implement ValidatingInteractionAdvisor, HidingInteractionAdvisor or DisablingInteractionAdvisor.


toStringValues

protected java.lang.String toStringValues()


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