Class ProcessorProvider

java.lang.Object
edu.ie3.datamodel.io.processor.ProcessorProvider

public class ProcessorProvider extends Object
Wrapper providing the class specific processor to convert an instance of a UniqueEntity into a mapping from attribute to value which can be used to write data e.g. into .csv files. This wrapper can always be used if it's not clear which specific instance of a subclass of UniqueEntity is received in the implementation. It can either be used for specific entity processors only or as a general provider for all known entity processors.
Since:
20.03.20
  • Constructor Details

  • Method Details

    • handleEntity

      public <T extends UniqueEntity> Optional<LinkedHashMap<String,String>> handleEntity(T entity)
    • handleTimeSeries

      public <T extends TimeSeries<E, V>, E extends TimeSeriesEntry<V>, V extends Value> Optional<Set<LinkedHashMap<String,String>>> handleTimeSeries(T timeSeries)
      Searches for the right processor and returns its result
      Type Parameters:
      T - Type of the time series
      E - Type of the time series entries
      V - Type of the value inside the time series entries
      Parameters:
      timeSeries - Time series to process
      Returns:
      A set of mappings from field name to value
    • getRegisteredClasses

      public List<Class<? extends UniqueEntity>> getRegisteredClasses()
      Returns all classes that are registered within entity processors known by this provider
      Returns:
      all classes this provider hols a processor for
    • getRegisteredTimeSeriesCombinations

      public Set<TimeSeriesProcessorKey> getRegisteredTimeSeriesCombinations()
    • getHeaderElements

      public String[] getHeaderElements(Class<? extends UniqueEntity> clazz) throws ProcessorProviderException
      Returns the header of a given entity class or throws an exception if no processor for the given class is known by this provider.
      Parameters:
      clazz - the class the header elements are requested for
      Returns:
      the header elements of the requested class
      Throws:
      ProcessorProviderException - If no matching processor can be found
    • getHeaderElements

      public String[] getHeaderElements(TimeSeriesProcessorKey processorKey) throws ProcessorProviderException
      Returns the header of a given time series combination or throws an exception if no processor for the given combination is known by this provider.
      Parameters:
      processorKey - Time series combination
      Returns:
      the header elements of the requested class
      Throws:
      ProcessorProviderException - If no matching processor can be found
    • allEntityProcessors

      public static Collection<EntityProcessor<? extends UniqueEntity>> allEntityProcessors()
      Build a collection of all existing processors
      Returns:
      a collection of all existing processors
    • allInputEntityProcessors

      public static Collection<EntityProcessor<? extends UniqueEntity>> allInputEntityProcessors()
      Build a collection of all input processors
      Returns:
      a collection of all input processors
    • allResultEntityProcessors

      public static Collection<EntityProcessor<? extends UniqueEntity>> allResultEntityProcessors()
      Build a collection of all result processors
      Returns:
      a collection of all result processors
    • allTimeSeriesProcessors

      Create processors for all known eligible combinations and map them
      Returns:
      A mapping from eligible combinations to processors