Converts the {@code String} to an object.
@param cls  the class to convert to, not null
@param str  the string to convert, not null
@return the converted object, may be null but generally not
968157
@Override
    public T convertFromString(Class<? extends T> cls, String str) {
        try {
            return cls.cast(fromString.invoke(null, str));
        } catch (IllegalAccessException ex) {
            throw new IllegalStateException("Method is not accessible: " + fromString);
        } catch (InvocationTargetException ex) {
            if (ex.getCause() instanceof RuntimeException) {
                throw (RuntimeException) ex.getCause();
            }
            throw new RuntimeException(ex.getMessage(), ex.getCause());
        }
    }
76226
public <T> T fromJson(@Nullable String jsonString, Class<T> clazz) {
		if (StringUtils.isEmpty(jsonString)) {
			return null;
		}

		try {
			return mapper.readValue(jsonString, clazz);
		} catch (IOException e) {
			logger.warn("parse json string error:" + jsonString, e);
			return null;
		}
	}
1374862
private <T> Constructor<T> findFromStringConstructorByType(Class<T> cls) {
        try {
            return cls.getDeclaredConstructor(String.class);
        } catch (NoSuchMethodException ex) {
            try {
                return cls.getDeclaredConstructor(CharSequence.class);
            } catch (NoSuchMethodException ex2) {
                throw new IllegalArgumentException("Constructor not found", ex2);
            }
        }
    }
1013811
@SuppressWarnings("unchecked")
    private <T> TypedStringConverter<T> findConverterQuiet(final Class<T> cls) {
        if (cls == null) {
            throw new IllegalArgumentException("Class must not be null");
        }
        TypedStringConverter<T> conv = (TypedStringConverter<T>) registered.get(cls);
        if (conv == CACHED_NULL) {
            return null;
        }
        if (conv == null) {
            try {
                conv = findAnyConverter(cls);
            } catch (RuntimeException ex) {
                registered.putIfAbsent(cls, CACHED_NULL);
                throw ex;
            }
            if (conv == null) {
                registered.putIfAbsent(cls, CACHED_NULL);
                return null;
            }
            registered.putIfAbsent(cls, conv);
        }
        return conv;
    }
582561
public static Object deserialize(String str) throws IOException, ClassNotFoundException, CoderException {
	ByteArrayInputStream bais = new ByteArrayInputStream(Base64Coder.decode(str));
	return deserialize(bais);
    }
19699
public static LazyElement parse(String str) throws LazyException{
		int index=0;
		while(index<str.length()){
			char ch=str.charAt(index);
			if(ch=='['){
				return new LazyArray(str);
			}
			if(ch=='{'){
				return new LazyObject(str);
			}
			index++;
		}
		throw new LazyException("The given string is not a JSON object or array");
	}
208897
private static String decode(final String str) {
        if (str == null) {
            return null;
        }

        for (int i = 0; i < str.length(); ++i) {
            if (str.charAt(i) == '%') {
                return decode(str, i);
            }
        }

        return str;
    }
699562
public static <T> T fromJsonString(String jsonString, Class<T> clazz) {
        return fromJsonString(jsonString, clazz, null);
    }
1084480
public static String decode(String str)
    {
        String ret = str;

        try
        {
            // De-obfuscate the string
            if(ret != null)
                ret = new String(Base64.decodeBase64(ret.getBytes()));
        }
        catch(NoClassDefFoundError e)
        {
            System.out.println("WARNING: unable to decode: "
                +e.getClass().getName()+": "+e.getMessage());
        }

        return ret;
    }
30569
public static Object convertStringToObject(String string)
    {
        try {
            return ClassServiceUtility.getClassService().convertStringToObject(string, null);
        } catch (ClassNotFoundException e) {
            throw new RuntimeException(e.getMessage());
        }
    }
732571
public <T> T readObject(Class<T> cls) {
    return kryo.readObject(input, cls);
  }
842768
protected Object jsonDeserialize(byte[] in, Class<?> cls) {
        if (in == null || in.length == 0) {
            return null;
        }
        Object res = null;
        try {
            res = JsonUtils.json2Object(new String(in, "utf-8"), cls);
        } catch (UnsupportedEncodingException e) {
            logger.error("DeSerialize object fail ", e);
        }
        return res;
    }
1339893
public static Object loadGenInstance(Class<?> cls) throws ParserException
    {
        try
        {
            Class<?> parserClass;
            try
            {
                parserClass = loadGenClass(cls);
            }
            catch (ClassNotFoundException ex)
            {
                return null;
            }
            return parserClass.newInstance();
        }
        catch (InstantiationException | IllegalAccessException ex)
        {
            throw new ParserException(ex);
        }
    }
246900
public Object fromString(String str)
    {
        if (StringUtils.isNotBlank(str)) {
            ObjectMapper objectMapper = new ObjectMapper();

            try {
                return objectMapper.readValue(str, Object.class);
            } catch (Exception e) {
                LOGGER.info("Failed to parse JSON [{}]: ", StringUtils.abbreviate(str, 32),
                    ExceptionUtils.getRootCauseMessage(e));

                return null;
            }
        }

        return null;
    }
1026778
@Override
    public StringConverter<?> findConverter(Class<?> cls) {
        Class<?> sup = cls.getSuperclass();
        if (sup == Enum.class) {
            return new EnumStringConverter(cls);
        } else if (sup != null && sup.getSuperclass() == Enum.class) {
            return new EnumStringConverter(sup);
        }
        return null;
    }
938955
@SuppressWarnings("unchecked")
    private <T> T parseElement(Element element, Class<T> cls) {
        T value;
        if (element == null) {
            value = null;
        } else if (MwsObject.class.isAssignableFrom(cls)) {
            value = MwsUtl.newInstance(cls);
            Element holdElement = currentElement;
            Node holdChild = currentChild;
            setCurrentElement(element);
            ((MwsObject) value).readFragmentFrom(this);
            currentElement = holdElement;
            currentChild = holdChild;
        } else if (cls == Object.class) {
            value = (T)element;
        } else {
            String v = getElementText(element);
            value = parseString(v, cls);
        }
        return value;
    }
209382
public static <T> T convertToObject(Class<T> clazz, String xml) {
		return convertToObject(clazz, new StringReader(xml));
	}