Get Instance of IJsonMarshaller from CDI
@param cls
@return
@throws JsonMarshallerException
429958
public IJsonMarshaller getIJsonMarshallerInstance(Class<? extends IJsonMarshaller> cls) throws JsonMarshallerException {
		if(logger.isDebugEnabled()) {
			logger.debug("Try to get {} by CDI.select Unsatisfied: {}", cls.getName(), CDI.current().select(cls).isUnsatisfied());
		}
		if(CDI.current().select(cls).isUnsatisfied()) {
			throw new JsonMarshallerException(cls.getName()+" is Unsatisfied");
		}
		return CDI.current().select(cls).get();
	}
1326611
public <T> Unmarshaller<T, JsonUnmarshallerContext> getUnmarshaller(Class<T> type, UnmarshallerType unmarshallerType) {
        return null;
    }
1099445
protected SerializerJson<?> createSerializer(Class<?> cl)
  {
    SerializerJson<?> ser = _staticSerMap.get(cl);

    if (ser != null) {
      return ser;
    }

    TypeRef typeRef = TypeRef.of(cl);
    
    if (cl.isArray()) {
      Class<?> eltType = cl.getComponentType();
      
      return new ObjectArraySerializerJson(eltType, serializer(eltType));
    }
    
    Method methodReplaceObject = findWriteReplace(cl);
    
    if (methodReplaceObject != null) {
      return new JavaSerializerWriteReplace(methodReplaceObject);
    }
    
    CollectionFunction collFun = _factoryMap.get(cl);
    
    if (collFun != null) {
      return collFun.apply(typeRef, this);
    }
    
    if (Map.class.isAssignableFrom(cl)) {
      return new MapJavaSerializer(typeRef, this, cl);
    }
    else if (Collection.class.isAssignableFrom(cl)) {
      return new ListJavaSerializer(typeRef, this, cl);
    }
    /*
    if (Collection.class.isAssignableFrom(cl)) {
      return new CollectionSerializerJson(typeRef, this);
    }

    if (Map.class.isAssignableFrom(cl)) {
      return new MapSerializerJson(typeRef, this, HashMap::new);
    }
    */
    
    ser = findInterfaceSerializer(cl);
    
    if (ser != null) {
      return ser;
    }

    if (AtomicInteger.class.isAssignableFrom(cl)) {
      return AtomicIntegerSerializer.SER;
    }

    if (Enum.class.isAssignableFrom(cl)) {
      return EnumSerializer.SER;
    }
    
    try {
      Method valueOf = cl.getMethod("valueOf", String.class);
      
      if (Modifier.isStatic(valueOf.getModifiers())) {
          //&& cl.equals(valueOf.getReturnType())) {
        return new StringValueOfSerializer<>(cl, valueOf);
      }
    } catch (NoSuchMethodException e) {
      log.log(Level.ALL, e.toString(), e);
    }

    return new JavaSerializerJson(typeRef, this);
  }
95285
@SuppressWarnings("unchecked")
	public static<X> Map<String, X> toMap(String json, Class<X> valClass) {
		Map<String, X> map = new HashMap<String, X>();
		try {
			JsonFactory f = new JsonFactory();
			JsonParser jp = f.createJsonParser(json);
			jp.nextToken(); // will return JsonToken.START_OBJECT (verify?)
			while (jp.nextToken() != JsonToken.END_OBJECT) {
				JsonToken token = jp.getCurrentToken();
				if(token.equals(JsonToken.FIELD_NAME)) {
					jp.nextToken();// to value token
					if(valClass.equals(Integer.class) || valClass.equals(int.class) ) {
						map.put(jp.getCurrentName(), (X) Integer.valueOf(jp.getIntValue()));
					} else if (valClass.equals(String.class)) {
						map.put(jp.getCurrentName(), (X) jp.getText());
					} else if (valClass.equals(Boolean.class) || valClass.equals(boolean.class)) {
						map.put(jp.getCurrentName(), (X) Boolean.valueOf(jp.getBooleanValue()));
					}
				}
			}
			jp.close();
		} catch (Exception e) {
			throw new RuntimeException(e);
		}
		return map;
	}
954117
@Provides
    @Singleton
    JacksonJsonProvider getJacksonJsonProvider(final ObjectMapper objectMapper)
    {
        final JacksonJsonProvider provider = new JacksonJsonProvider();
        provider.setMapper(objectMapper);
        return provider;
    }
584784
public static String toJsonString(Object obj, ClassLoader classLoader) {
        if (obj == null) {
            return "null";
        }
        ClassLoader oldClassLoader = Thread.currentThread().getContextClassLoader();
        if (classLoader != null) {
            Thread.currentThread().setContextClassLoader(classLoader);
        }
        try {
            ObjectMapper mapper = poolMapper.borrowObject();
            if (mapper != null) {
                try {
                    return mapper.writeValueAsString(obj);
                } finally {
                    poolMapper.returnObject(mapper);
                }
            }
            throw new SerializationException("No ObjectMapper instance avaialble!");
        } catch (Exception e) {
            throw e instanceof SerializationException ? (SerializationException) e
                    : new SerializationException(e);
        } finally {
            Thread.currentThread().setContextClassLoader(oldClassLoader);
        }
    }
339792
@Nullable
	public static <T> InterfaceDescriptor<T> findInterfaceDescriptor(final Class<T> cls) {
		if (!cls.isInterface()) {
			throw new IllegalArgumentException("Interface required, got " + cls);
		}

		Field field;
		try {
			field = cls.getField("DESCRIPTOR");
		} catch (NoSuchFieldException e) {
			throw new IllegalArgumentException("No DESCRIPTOR field in " + cls);
		}

		if (!InterfaceDescriptor.class.isAssignableFrom(field.getType())) {
			throw new IllegalArgumentException("Not an InterfaceDescriptor field, " + field);
		}

		try {
			// Get the static TYPE field.
			@SuppressWarnings("unchecked")
			InterfaceDescriptor<T> descriptor = (InterfaceDescriptor<T>) field.get(null);
			return descriptor;
		} catch (IllegalAccessException e) {
			throw new RuntimeException(e);
		}
	}
1219986
public static JsonNode readJson(String source, ClassLoader classLoader) {
        return SerializationUtils.readJson(source, classLoader);
    }
1321039
@SuppressWarnings("unchecked")
    public static <T extends BaseBo> T fromJson(String json, Class<T> clazz,
            ClassLoader classLoader) {
        if (StringUtils.isBlank(json) || clazz == null) {
            return null;
        }
        try {
            Map<String, Object> data = SerializationUtils.fromJsonString(json, Map.class);
            String boClassName = DPathUtils.getValue(data, FIELD_CLASSNAME, String.class);
            T bo = createObject(boClassName, classLoader, clazz);
            if (bo != null) {
                bo.fromJson(DPathUtils.getValue(data, FIELD_BODATA, String.class));
                return bo;
            } else {
                return null;
            }
        } catch (Exception e) {
            throw e instanceof DeserializationException ? (DeserializationException) e
                    : new DeserializationException(e);
        }
    }
1058005
public Serializer getSerializer(Class cls) {
    SerializerWrapper w = getSerializerWrapper(cls);
    if (w != null) {
      return w.serializer;
    }
    return null;
  }
1111601
public static JAXBSerialiser getInstance(Class<?>... classes)
	{
		if (log.isTraceEnabled())
			log.trace("Create serialiser for " + Arrays.asList(classes));

		return new JAXBSerialiser(classes);
	}
991217
public static <E> JsonMapper<E> mapperFor(Class<E> cls) throws NoSuchMapperException {
        JsonMapper<E> mapper = getMapper(cls);

        if (mapper == null) {
            throw new NoSuchMapperException(cls);
        } else {
            return mapper;
        }
    }
1271661
public static JsonNode readJson(Reader source, ClassLoader classLoader) {
        return SerializationUtils.readJson(source, classLoader);
    }
398677
public static <T> T unmarshal(Class<T> cl, File f) throws JAXBException {
    return unmarshal(cl, new StreamSource(f));
  }
1165633
static public Object deserialize(InputStream in, Class<?> cls)
		throws IOException
	{
		if (cls==null)
			throw new NullPointerException("cls");
		
		Object obj = deserialize(in);
		if (!cls.isInstance(obj))
		{
			throw new InvalidObjectException("type of deserialized instance not of required class.");
		}
		
		return obj;
	}
86998
private SerializerWrapper getSerializerWrapper(Class cls) {
    SerializerWrapper w = serializers.get(cls);
    if (w != null) {
      return w;
    } else {
      // Try with interfaces implemented
      for (Class c : cls.getInterfaces()) {
        w = serializers.get(c);
        if (w != null) {
          return w;
        }
      }
    }
    return null;
  }
846808
public static JsonUtil getInstance() {

    if (instance == null) {
      synchronized (JsonUtilImpl.class) {
        if (instance == null) {
          JsonUtilImpl impl = new JsonUtilImpl();
          impl.initialize();
        }
      }
    }
    return instance;
  }