logback-android/src/main/java/ch/qos/logback/core/joran/util/StringToObjectConverter.java
@SuppressWarnings("unchecked")
  public static Object convertArg(ContextAware ca, String val, Class<?> type) {
    if (val == null) {
      return null;
    }
    String v = val.trim();
    if (String.class.isAssignableFrom(type)) {
      return v;
    } else if (Integer.TYPE.isAssignableFrom(type)) {
      return Integer.valueOf(v);
    } else if (Long.TYPE.isAssignableFrom(type)) {
      return Long.valueOf(v);
    } else if (Float.TYPE.isAssignableFrom(type)) {
      return Float.valueOf(v);
    } else if (Double.TYPE.isAssignableFrom(type)) {
      return Double.valueOf(v);
    } else if (Boolean.TYPE.isAssignableFrom(type)) {
      if ("true".equalsIgnoreCase(v)) {
        return Boolean.TRUE;
      } else if ("false".equalsIgnoreCase(v)) {
        return Boolean.FALSE;
      }
    } else if (type.isEnum()) {
      return convertToEnum(ca, v, (Class<? extends Enum<?>>) type);
    } else if (StringToObjectConverter.followsTheValueOfConvention(type)) {
      return convertByValueOfMethod(ca, type, v);
    } else if (isOfTypeCharset(type)) {
      return convertToCharset(ca, val);
    }

    return null;
  }
@SuppressWarnings("unchecked")
  public static Object convertArg(ContextAware ca, String val, Class<?> type) {
    if (val == null) {
      return null;
    }
    String v = val.trim();
    if (String.class.isAssignableFrom(type)) {
      return v;
    } else if (Integer.TYPE.isAssignableFrom(type)) {
      return Integer.valueOf(v);
    } else if (Long.TYPE.isAssignableFrom(type)) {
      return Long.valueOf(v);
    } else if (Float.TYPE.isAssignableFrom(type)) {
      return Float.valueOf(v);
    } else if (Double.TYPE.isAssignableFrom(type)) {
      return Double.valueOf(v);
    } else if (Boolean.TYPE.isAssignableFrom(type)) {
      if ("true".equalsIgnoreCase(v)) {
        return Boolean.TRUE;
      } else if ("false".equalsIgnoreCase(v)) {
        return Boolean.FALSE;
      }
    } else if (type.isEnum()) {
      return convertToEnum(ca, v, (Class<? extends Enum<?>>) type);
    } else if (StringToObjectConverter.followsTheValueOfConvention(type)) {
      return convertByValueOfMethod(ca, type, v);
    } else if (isOfTypeCharset(type)) {
      return convertToCharset(ca, val);
    }

    return null;
  }
Convert <code>val</code> a String parameter to an object of a given type.
@param ca context
@param val string representation of value
@param type target class to convert val into
@return the object created from the string