org.nakedobjects.metamodel.facets.FacetHolder Maven / Gradle / Ivy
package org.nakedobjects.metamodel.facets;
import org.nakedobjects.metamodel.commons.filters.Filter;
/**
* Anything in the metamodel (which also includes peers in the reflector) that can be extended.
*/
public interface FacetHolder {
/**
* Get the list of all facet types that are supported by objects of this specification.
*/
Class[] getFacetTypes();
/**
* Whether there is a facet registered of the specified type.
*
*
* Convenience; saves having to {@link #getFacet(Class)} and then check if null.
*/
boolean containsFacet(Class facetType);
/**
* Get the facet of the specified type (as per the type it reports from {@link Facet#facetType()}).
*/
T getFacet(Class cls);
/**
* Returns all {@link Facet}s matching the specified {@link FacetFilter}.
*
* @param filter
* @return
*/
Facet[] getFacets(Filter filter);
/**
* Adds the facet, extracting its {@link Facet#facetType() type} as the key.
*
*
* If there are any facet of the same type, they will be overwritten provided that either the
* {@link Facet} specifies to {@link Facet#alwaysReplace() always replace} or if the existing
* {@link Facet} is a {@link Facet#isNoop() no-op}.
*/
void addFacet(Facet facet);
/**
* Adds the {@link MultiTypedFacet multi-typed facet}, extracting each of its
* {@link MultiTypedFacet#facetTypes() types} as keys.
*
*
* If there are any facet of the same type, they will be overwritten provided that either the
* {@link Facet} specifies to {@link Facet#alwaysReplace() always replace} or if the existing
* {@link Facet} is a {@link Facet#isNoop() no-op}.
*/
void addFacet(MultiTypedFacet facet);
/**
* Remove the facet whose type is that reported by {@link Facet#facetType()}.
*/
void removeFacet(Facet facet);
/**
* Remove the facet of the specified type.
*/
void removeFacet(Class facetType);
}