code: public static Object valueOf(Class<?> type, String value) {
  		try {
  			if (type.equals(java.lang.String.class)) {
  				return value;
  			}
  
  			Method m = class2Value.get(type);
  			if (m != null) {
  				return m.invoke(null, value);
  			}
  
  			if (type.equals(java.lang.Character.TYPE)
  					|| type.equals(java.lang.Character.class)) {
  				return new Character(value.charAt(0));
  			}
  
  			Constructor<?> c = type.getConstructor(java.lang.String.class);
  			return c.newInstance(value);
  		} catch (NoSuchMethodException | InstantiationException | IllegalAccessException e) {
  			// LogSupport.ignore(log,e);
  		} catch (InvocationTargetException e) {
  			if (e.getTargetException() instanceof Error) {
  				throw (Error) (e.getTargetException());
  			}
  		}
  		return null;
  	}
docs: Convert String value to instance.
  
  @param type  The class of the instance, which may be a primitive TYPE
  field.
  @param value The value as a string.
  @return The value as an Object.