public static String format(final Object value) {
    Method formatMethod;
    try {
      formatMethod = OptionParser.class.getMethod("format", value.getClass());
    } catch (NoSuchMethodException e) {
      try {
        // maybe a primitive version of the method exists
        formatMethod =
            OptionParser.class.getMethod(
                "format", MethodType.methodType(value.getClass()).unwrap().returnType());
      } catch (NoSuchMethodException ex) {
        return value.toString();
      }
    }

    try {
      return (String) formatMethod.invoke(null, value);
    } catch (InvocationTargetException | IllegalAccessException e) {
      throw new RuntimeException(e);
    }
  }
Format any object to string. This implementation tries to find an existing format method, in
this class, that matches the type of the passed object, and if not found just invoke, to string
on the passed object

@param value the object
@return the string
app/src/main/java/org/hyperledger/besu/cli/options/OptionParser.java