All Downloads are FREE. Search and download functionalities are using the official Maven repository.

fitnesse.reporting.FormatterFactory Maven / Gradle / Ivy

The newest version!
package fitnesse.reporting;

import java.util.ArrayList;
import java.util.List;

import fitnesse.components.ComponentFactory;

public class FormatterFactory implements FormatterRegistry {


  private final ComponentFactory componentFactory;
  private List> formatters;

  public FormatterFactory(ComponentFactory componentFactory) {
    this.componentFactory = componentFactory;
    formatters = new ArrayList<>();
  }

  @Override
  public void registerFormatter(Class formatter) {
    formatters.add(formatter);
  }

  public Formatter[] createFormatters() {
    Formatter[] instances = new Formatter[formatters.size()];
    for (int i = 0; i < formatters.size(); i++) {
      instances[i] = componentFactory.createComponent(formatters.get(i));
    }
    return instances;
  }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy