package io.asfjava.ui.core;

import java.util.HashMap;

import io.asfjava.ui.core.generators.FormDefinitionGenerator;

public final class FormDefinitionGeneratorFactory {

	public FormDefinitionGenerator getGenerator(String annotationName) {
		return GENERATORS.get(annotationName);
	}

	void register(String annotationName, FormDefinitionGenerator generator) {
		GENERATORS.put(annotationName, generator);
	}

	public static FormDefinitionGeneratorFactory getInstance() {
		if (INSTANCE == null) {
			INSTANCE = new FormDefinitionGeneratorFactory();
		}
		return INSTANCE;
	}

	private static final HashMap<String, FormDefinitionGenerator> GENERATORS = new HashMap<>();

	private static FormDefinitionGeneratorFactory INSTANCE;

	private FormDefinitionGeneratorFactory() {
	}
}

@@ -39,16 +39,59 @@
 va.util.
+Map;%0Aimport java.util.concurrent.Concurrent
 HashMap;
@@ -636,20 +636,16 @@
 c final 
-Hash
 Map%3CStri
@@ -694,17 +694,25 @@
 new 
+Concurrent
 HashMap
-%3C%3E
 ();%0A

replace hashMap by ConcurentHashMap in order to be Thread safe