1111import java .util .Map ;
1212import java .util .function .BiFunction ;
1313
14- /** This singleton- class manages the instantiation of reporters.
14+ /** This class manages the instantiation of reporters.
1515 * One can register a supplier method for a specific name which will then be callable via createReporter(name)
1616 *
1717 * @author pesse
@@ -28,10 +28,8 @@ public ReporterInfo(BiFunction<String, Object[], ? extends Reporter> factoryMeth
2828 }
2929
3030 private Map <String , ReporterInfo > reportFactoryMethodMap = new HashMap <>();
31-
32- private static ReporterFactory instance ;
3331
34- private ReporterFactory () {
32+ public ReporterFactory () {
3533 registerDefaultReporters ();
3634 }
3735
@@ -42,24 +40,6 @@ private void registerDefaultReporters() {
4240 .forEach (r -> registerReporterFactoryMethod (r .name (), r .getFactoryMethod (), r .getDescription ()));
4341 }
4442
45- /** Returns the global instance of the ReporterFactory
46- *
47- * @return ReporterFactory
48- */
49- public static ReporterFactory getInstance () {
50- if ( instance == null )
51- instance = new ReporterFactory ();
52- return instance ;
53- }
54-
55- public static Reporter create ( CoreReporters reporter ) {
56- return getInstance ().createReporter (reporter );
57- }
58-
59- public static Reporter create ( String reporter ) {
60- return getInstance ().createReporter (reporter );
61- }
62-
6343 /** Registers a creation method for a specified reporter name. Overrides eventually existing creation method
6444 *
6545 * @param reporterName the reporter's name to register
@@ -68,7 +48,7 @@ public static Reporter create( String reporter ) {
6848 * @return Object with information about the registered reporter
6949 */
7050 public synchronized ReporterInfo registerReporterFactoryMethod ( String reporterName , BiFunction <String , Object [], ? extends Reporter > factoryMethod , String description ) {
71- return reportFactoryMethodMap .put (reporterName , new ReporterInfo (factoryMethod , description ));
51+ return reportFactoryMethodMap .put (reporterName . toUpperCase () , new ReporterInfo (factoryMethod , description ));
7252 }
7353
7454 /** Unregisters a specified reporter name.
@@ -77,7 +57,7 @@ public synchronized ReporterInfo registerReporterFactoryMethod( String reporterN
7757 * @return information about the reporter which was previously registered or null
7858 */
7959 public synchronized ReporterInfo unregisterReporterFactoryMethod ( String reporterName ) {
80- return reportFactoryMethodMap .remove (reporterName );
60+ return reportFactoryMethodMap .remove (reporterName . toUpperCase () );
8161 }
8262
8363 /** Returns a new reporter of the given name.
@@ -89,6 +69,7 @@ public synchronized ReporterInfo unregisterReporterFactoryMethod( String reporte
8969 */
9070 public Reporter createReporter (String reporterName , Object [] attributes ) {
9171
72+ reporterName = reporterName .toUpperCase ();
9273 BiFunction <String , Object [], ? extends Reporter > supplier = DefaultReporter ::new ;
9374
9475 if ( reportFactoryMethodMap .containsKey (reporterName )) {
0 commit comments