@SuppressWarnings("unchecked")
  public static <T> T convertValue(Object rawValue, Class<?> clazz) {
    if (Integer.class.equals(clazz)) {
      return (T) convertToInt(rawValue);
    } else if (Long.class.equals(clazz)) {
      return (T) convertToLong(rawValue);
    } else if (Boolean.class.equals(clazz)) {
      return (T) convertToBoolean(rawValue);
    } else if (Float.class.equals(clazz)) {
      return (T) convertToFloat(rawValue);
    } else if (Double.class.equals(clazz)) {
      return (T) convertToDouble(rawValue);
    } else if (String.class.equals(clazz)) {
      return (T) convertToString(rawValue);
    } else if (clazz.isEnum()) {
      return (T) convertToEnum(rawValue, (Class<? extends Enum<?>>) clazz);
    } else if (clazz == Duration.class) {
      return (T) convertToDuration(rawValue);
    } else if (clazz == Map.class) {
      return (T) convertToProperties(rawValue);
    } else if (clazz == MemorySize.class) {
      return (T) convertToMemorySize(rawValue);
    }

    throw new IllegalArgumentException("Unsupported type: " + clazz);
  }
Tries to convert the raw value into the provided type.

@param rawValue rawValue to convert into the provided type clazz
@param clazz clazz specifying the target type
@param <T> type of the result
@return the converted value if rawValue is of type clazz
@throws IllegalArgumentException if the rawValue cannot be converted in the specified target
    type clazz
amoro-common/src/main/java/org/apache/amoro/config/ConfigHelpers.java