fitnesse.reporting.FormatterFactory Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of fitnesse Show documentation
Show all versions of fitnesse Show documentation
The fully integrated standalone wiki, and acceptance testing framework.
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 extends Formatter> 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;
}
}