org.nakedobjects.metamodel.facets
Class FacetHolderImpl

java.lang.Object
  extended by org.nakedobjects.metamodel.facets.FacetHolderImpl
All Implemented Interfaces:
FacetHolder
Direct Known Subclasses:
IdentifiedImpl, IntrospectableSpecificationAbstract, JavaNakedObjectActionParamPeer, JavaNakedObjectMemberPeer, NamedAndDescribedFacetHolderImpl

public class FacetHolderImpl
extends java.lang.Object
implements FacetHolder

For base subclasses or, more likely, to help write tests.


Constructor Summary
FacetHolderImpl()
           
 
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.
<T extends Facet>
T
getFacet(java.lang.Class<T> facetType)
          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.
 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().
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FacetHolderImpl

public FacetHolderImpl()
Method Detail

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

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

getFacet

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

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:


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