private Class initTypeConfig()

in src/main/java/com/epam/eco/commons/kafka/serde/JsonDeserializer.java [61:82]


    private Class<T> initTypeConfig(Map<String, ?> configs, boolean isKey) {
        String typeConfigKey = isKey ? KEY_TYPE : VALUE_TYPE;

        if (configs.get(typeConfigKey) == null) {
            throw new RuntimeException(
                    String.format("Configuration '%s' is missing", typeConfigKey));
        }

        Object typeOrName = configs.get(typeConfigKey);
        if (typeOrName instanceof Class) {
            return (Class<T>)typeOrName;
        } else if (typeOrName instanceof String) {
            try {
                return (Class<T>) ClassUtils.getClass((String)typeOrName);
            } catch (ClassNotFoundException cnfe) {
                throw new RuntimeException(cnfe);
            }
        } else {
            throw new IllegalArgumentException(
                    String.format("Illegal value for configuration '%s': %s", typeConfigKey, typeOrName));
        }
    }