code: public static Object convertStringToWrapper(String str, Class<?> wrapper) {
          log.trace("String: {} to wrapper: {}", str, wrapper);
          if (wrapper.equals(String.class)) {
              return str;
          } else if (wrapper.equals(Boolean.class)) {
              return Boolean.valueOf(str);
          } else if (wrapper.equals(Double.class)) {
              return Double.valueOf(str);
          } else if (wrapper.equals(Long.class)) {
              return Long.valueOf(str);
          } else if (wrapper.equals(Float.class)) {
              return Float.valueOf(str);
          } else if (wrapper.equals(Integer.class)) {
              return Integer.valueOf(str);
          } else if (wrapper.equals(Short.class)) {
              return Short.valueOf(str);
          } else if (wrapper.equals(Byte.class)) {
              return Byte.valueOf(str);
          }
          throw new ConversionException(String.format("Unable to convert string to: %s", wrapper));
      }
docs: Convert string to primitive wrapper like Boolean or Float
  
  @param str
  String to convert
  @param wrapper
  Primitive wrapper type
  @return Converted object