java.lang.Object
com.foursoft.harness.navext.runtime.postprocessing.ModelPostProcessorRegistry

public class ModelPostProcessorRegistry extends Object
  • Constructor Details

    • ModelPostProcessorRegistry

      public ModelPostProcessorRegistry(String contextPath)
  • Method Details

    • addDefaultPostProcessor

      public ModelPostProcessorRegistry addDefaultPostProcessor(ModelPostProcessor postProcessor)
      Adds a default post processor. It will be used if no special postprocessor is specified.
      Parameters:
      postProcessor - the post processor
      Returns:
      this for fluent API
    • withFactory

      public ModelPostProcessorRegistry withFactory(Function<Class<?>,ModelPostProcessor> modelPostProcessorFactory)
      Register a factory function that is called once for each class to create an individual ModelPostProcessor instance for the given class. The ModelPostProcessor shall handle the necessary aspects of the given class only, for inherited aspects of super classes an individual ModelPostProcessor is created.
      Parameters:
      modelPostProcessorFactory - a function providing a special post processor per class
      Returns:
      this for fluent API
    • clearStateOfPostProcessors

      public void clearStateOfPostProcessors()
      Clear the state of all ModelPostProcessor currently registered, to allow garbage collection and reuse during multiple unmarshallings.
      See Also:
    • findModelPostProcessors

      public <T extends ModelPostProcessor> List<T> findModelPostProcessors(Class<T> postProcessorType)
      Finds all registered default ModelPostProcessors that are an instance of postProcessorType.
      Type Parameters:
      T - the type of processors to look for
      Parameters:
      postProcessorType - the class of the post processors to find
      Returns:
      the list of processor of the given type. Can be empty - never null.
    • postProcessorsFor

      public List<ModelPostProcessor> postProcessorsFor(Class<?> classToHandle)
      Retrieves a list of all ModelPostProcessor that are registered in this registry and that are applicable for classToHandle.

      Applicable ModelPostProcessors are basically all that satisfy the interface and can handle the given class. ModelPostProcessor.getClassToHandle().isAssignableFrom(classToHandle).

      Parameters:
      classToHandle - the class to processor
      Returns:
      the list of post processors found for the given class.