code: 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);
              }
          }
      }
docs: Finds the conversion method.
  
  @param <T>  the type of the converter
  @param cls  the class to find a method for, not null
  @return the method to call, null means use {@code toString}