/* This Source Code Form is subject to the terms of the Mozilla Public
 * License, v. 2.0. If a copy of the MPL was not distributed with this
 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
package org.ocelotds.marshalling;

import org.ocelotds.marshalling.exceptions.JsonMarshallerException;
import javax.enterprise.inject.spi.CDI;

/**
 *
 * @author hhfrancois
 */
public class JsonMarshallerServices {
	
	public IJsonMarshaller getIJsonMarshallerInstance(Class<? extends IJsonMarshaller> cls) throws JsonMarshallerException {
		return CDI.current().select(cls).get();
	}
}

@@ -233,16 +233,130 @@
 lling;%0A%0A
+import javax.enterprise.inject.spi.CDI;%0Aimport javax.inject.Inject;%0Aimport org.ocelotds.annotations.OcelotLogger;%0A
 import o
@@ -426,39 +426,24 @@
 ort 
-javax.enterprise.inject.spi.CDI
+org.slf4j.Logger
 ;%0A%0A/
@@ -514,16 +514,58 @@
 ces %7B%0A%09%0A
+%09@Inject%0A%09@OcelotLogger%0A%09Logger logger;%0A%09%0A
 %09public 
@@ -678,16 +678,451 @@
 ption %7B%0A
+%09%09if(CDI.current().select(cls).isUnsatisfied()) %7B%0A%09%09%09if(logger.isDebugEnabled()) %7B%0A%09%09%09%09logger.debug(%22Try to get %7B%7D by CDI.select Unsatisfied: %7B%7D%22, cls.getName(), CDI.current().select(cls).isUnsatisfied());%0A%09%09%09%7D%0A%09%09%09try %7B%0A%09%09%09%09IJsonMarshaller result = cls.newInstance();%0A%09%09%09%09return result;%0A %09%09%09%7D catch (InstantiationException %7C IllegalAccessException ex) %7B%0A%09%09%09%09throw new JsonMarshallerException(cls.getName()+%22 is Unsatisfied%22);%0A%09%09%09%7D%0A%09%09%7D%0A
 %09%09return

fix bug CDI