/* 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.Any;
import javax.enterprise.inject.Instance;
import javax.inject.Inject;

/**
 *
 * @author hhfrancois
 */
public class JsonMarshallerServices {
	@Inject 
	@Any
	Instance<IJsonMarshaller> iJsonMarshallers;

	public IJsonMarshaller getIJsonMarshallerInstance(Class<? extends IJsonMarshaller> cls) throws JsonMarshallerException {
		if(iJsonMarshallers.select(cls).isUnsatisfied()) {
			try {
				return cls.newInstance();
			} catch (InstantiationException | IllegalAccessException ex) {
				throw new JsonMarshallerException(cls.getSimpleName()+" is Unsatisfied");
			}
		}
		return iJsonMarshallers.select(cls).get();
	}
}

@@ -336,80 +336,15 @@
 ect.
-Any;%0Aimport javax.enterprise.inject.Instance;%0Aimport javax.inject.Inject
+spi.CDI
 ;%0A%0A/
@@ -418,68 +418,8 @@
  %7B%0A%09
-@Inject %0A%09@Any%0A%09Instance%3CIJsonMarshaller%3E iJsonMarshallers;%0A
 %0A%09pu
@@ -543,276 +543,28 @@
 %7B%0A%09%09
-if(iJsonMarshallers.select(cls).isUnsatisfied()) %7B%0A%09%09%09try %7B%0A%09%09%09%09return cls.newInstance();%0A%09%09%09%7D catch (InstantiationException %7C IllegalAccessException ex) %7B%0A%09%09%09%09throw new JsonMarshallerException(cls.getSimpleName()+%22 is Unsatisfied%22);%0A%09%09%09%7D%0A%09%09%7D%0A%09%09return iJsonMarshallers
+return CDI.current()
 .sel

fix select IJsonMarshaller