org.nakedobjects.metamodel.specloader.internal.facetprocessor
Class FacetProcessor

java.lang.Object
  extended by org.nakedobjects.metamodel.specloader.internal.facetprocessor.FacetProcessor
All Implemented Interfaces:
RuntimeContextAware

public class FacetProcessor
extends java.lang.Object
implements RuntimeContextAware


Constructor Summary
FacetProcessor(NakedObjectConfiguration configuration, SpecificationLoader specificationLoader, CollectionTypeRegistry collectionTypeRegistry, ProgrammingModelFacets programmingModelFacets)
           
 
Method Summary
 void findAndRemoveCollectionAccessors(MethodRemover methodRemover, java.util.List<java.lang.reflect.Method> methodListToAppendTo)
          Use the provided MethodRemover to have all known PropertyOrCollectionIdentifyingFacetFactorys to remove all property accessors, and append them to the supplied methodList.
 void findAndRemovePropertyAccessors(MethodRemover methodRemover, java.util.List<java.lang.reflect.Method> methodListToAppendTo)
          Use the provided MethodRemover to have all known PropertyOrCollectionIdentifyingFacetFactorys to remove all property accessors, and append them to the supplied methodList.
 java.util.Set<java.lang.reflect.Method> findPropertyOrCollectionCandidateAccessors(java.lang.reflect.Method[] methods, java.util.Set<java.lang.reflect.Method> candidates)
          Appends to the supplied Set all of the Methods that may represent a property or collection.
 FacetFactory getFactoryByFactoryType(java.lang.Class<? extends FacetFactory> factoryType)
           
 void init()
           
 void injectDependenciesInto(FacetFactory factory)
          This is public so that can be used for @Facets processing in JavaIntrospector.
 boolean process(java.lang.Class<?> cls, MethodRemover methodRemover, FacetHolder facetHolder)
          Attaches all facets applicable to the provided object) to the supplied FacetHolder.
 boolean process(java.lang.reflect.Method method, MethodRemover methodRemover, FacetHolder facetHolder, NakedObjectFeatureType featureType)
          Attaches all facets applicable to the provided type of feature to the supplied FacetHolder.
 boolean processParams(java.lang.reflect.Method method, int paramNum, FacetHolder facetHolder)
          Attaches all facets applicable to the provided parameter), to the supplied FacetHolder.
 boolean recognizes(java.lang.reflect.Method method)
          Whether this method is recognized by any of the FacetFactorys.
 void registerFactory(FacetFactory factory)
           
 void setRuntimeContext(RuntimeContext runtimeContext)
          Injected so can propogate to any registered FacetFactory s that are also RuntimeContextAware.
 void shutdown()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FacetProcessor

public FacetProcessor(NakedObjectConfiguration configuration,
                      SpecificationLoader specificationLoader,
                      CollectionTypeRegistry collectionTypeRegistry,
                      ProgrammingModelFacets programmingModelFacets)
Method Detail

init

public void init()

shutdown

public void shutdown()

registerFactory

public void registerFactory(FacetFactory factory)

injectDependenciesInto

public void injectDependenciesInto(FacetFactory factory)
This is public so that can be used for @Facets processing in JavaIntrospector.

See bug-517.


getFactoryByFactoryType

public FacetFactory getFactoryByFactoryType(java.lang.Class<? extends FacetFactory> factoryType)

findPropertyOrCollectionCandidateAccessors

public java.util.Set<java.lang.reflect.Method> findPropertyOrCollectionCandidateAccessors(java.lang.reflect.Method[] methods,
                                                                                          java.util.Set<java.lang.reflect.Method> candidates)
Appends to the supplied Set all of the Methods that may represent a property or collection.

Delegates to all known PropertyOrCollectionIdentifyingFacetFactorys.


findAndRemovePropertyAccessors

public void findAndRemovePropertyAccessors(MethodRemover methodRemover,
                                           java.util.List<java.lang.reflect.Method> methodListToAppendTo)
Use the provided MethodRemover to have all known PropertyOrCollectionIdentifyingFacetFactorys to remove all property accessors, and append them to the supplied methodList.

Intended to be called after #findAndRemoveValuePropertyAccessors(MethodRemover, List) once only reference properties remain.

See Also:
PropertyOrCollectionIdentifyingFacetFactory#findAndRemoveValuePropertyAccessors(MethodRemover, List)

findAndRemoveCollectionAccessors

public void findAndRemoveCollectionAccessors(MethodRemover methodRemover,
                                             java.util.List<java.lang.reflect.Method> methodListToAppendTo)
Use the provided MethodRemover to have all known PropertyOrCollectionIdentifyingFacetFactorys to remove all property accessors, and append them to the supplied methodList.

See Also:
PropertyOrCollectionIdentifyingFacetFactory.findAndRemoveCollectionAccessors(MethodRemover, List)

recognizes

public boolean recognizes(java.lang.reflect.Method method)
Whether this method is recognized by any of the FacetFactorys.

Typically this is when method has a specific prefix, such as validate or hide. Specifically, it checks:

The design of MethodPrefixBasedFacetFactory (whereby this facet factory set does the work) is a slight performance optimization for when there are multiple facet factories that search for the same prefix.


process

public boolean process(java.lang.Class<?> cls,
                       MethodRemover methodRemover,
                       FacetHolder facetHolder)
Attaches all facets applicable to the provided object) to the supplied FacetHolder.

Delegates to FacetFactory#process(Class, FacetHolder) for each appropriate factory.

Parameters:
cls - - class to process
facetHolder - - holder to attach facets to.
Returns:
true if any facets were added, false otherwise.
See Also:
FacetFactory.process(Class, MethodRemover, FacetHolder)

process

public boolean process(java.lang.reflect.Method method,
                       MethodRemover methodRemover,
                       FacetHolder facetHolder,
                       NakedObjectFeatureType featureType)
Attaches all facets applicable to the provided type of feature to the supplied FacetHolder.

Delegates to FacetFactory#process(Method, FacetHolder) for each appropriate factory.

Parameters:
method - - method to process
facetHolder - - holder to attach facets to.
featureType - - what type of feature the method represents (property, action, collection etc)
Returns:
true if any facets were added, false otherwise.
See Also:
FacetFactory#process(Method, FacetHolder)

processParams

public boolean processParams(java.lang.reflect.Method method,
                             int paramNum,
                             FacetHolder facetHolder)
Attaches all facets applicable to the provided parameter), to the supplied FacetHolder.

Delegates to FacetFactory.processParams(Method, int, FacetHolder) for each appropriate factory.

Parameters:
method - - action method to process
paramNum - - 0-based
facetHolder - - holder to attach facets to.
Returns:
true if any facets were added, false otherwise.
See Also:
FacetFactory.processParams(Method, int, FacetHolder)

setRuntimeContext

public void setRuntimeContext(RuntimeContext runtimeContext)
Injected so can propogate to any registered FacetFactory s that are also RuntimeContextAware.

Specified by:
setRuntimeContext in interface RuntimeContextAware


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