package io.asfjava.ui.core;

import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;

import io.asfjava.ui.core.schema.decorators.SchemaDecorator;

public final class SchemaDecoratorFactory {
	public SchemaDecorator getDecorator(String annotationName) {
		return decorators.get(annotationName);
	}

	void register(String annotationName, SchemaDecorator generator) {
		decorators.put(annotationName, generator);
	}

	public static SchemaDecoratorFactory getInstance() {
		if (instance == null) {
			instance = new SchemaDecoratorFactory();
		}
		return instance;
	}

	private static final Map<String, SchemaDecorator> decorators = new ConcurrentHashMap<>();

	private static SchemaDecoratorFactory instance;

	private SchemaDecoratorFactory() {
	}
}

@@ -44,16 +44,43 @@
 il.Map;%0A
+import java.util.Optional;%0A
 import j
@@ -118,16 +118,16 @@
 ashMap;%0A
-
 %0Aimport 
@@ -233,16 +233,25 @@
 %09public 
+Optional%3C
 SchemaDe
@@ -257,16 +257,17 @@
 ecorator
+%3E
  getDeco
@@ -306,16 +306,36 @@
 %09return 
+Optional.ofNullable(
 decorato
@@ -356,16 +356,17 @@
 ionName)
+)
 ;%0A%09%7D%0A%0A%09v

use Optional Object in order to avoid null return