docs: public Object invokeMethod(String name, Object args) {
          boolean notExpectedArgs = false;
          if (args != null && Object[].class.isAssignableFrom(args.getClass())) {
              Object[] arr = (Object[]) args;
              try {
                  switch(arr.length) {
                      case 0:
                          call(name);
                      break;
                      case 1:
                          if (arr[0] instanceof Closure) {
                              final Closure callable = (Closure) arr[0];
                              call(name, callable);
                          } else if (arr[0] instanceof Map) {
                              final Map<String, Map> map = Collections.singletonMap(name, (Map) arr[0]);
                              call(map);
                          } else {
                              notExpectedArgs = true;
                          }
                      break;
                      case 2:
                          final Object first = arr[0];
                          final Object second = arr[1];
                          final boolean isClosure = second instanceof Closure;
  
                          if(isClosure && first instanceof Map ) {
                              final Closure callable = (Closure) second;
                              call(name, (Map)first, callable);
                          }
                          else if(isClosure && first instanceof Iterable) {
                              final Iterable coll = (Iterable) first;
                              final Closure callable = (Closure) second;
                              call(name, coll, callable);
                          }
                          else if(isClosure && first.getClass().isArray()) {
                              final Iterable coll = Arrays.asList((Object[])first);
                              final Closure callable = (Closure) second;
                              call(name, coll, callable);
                          }
                          else {
                              notExpectedArgs = true;
                          }
                      break;
                      default:
                          notExpectedArgs = true;
                  }
              } catch (IOException ioe) {
                  throw new JsonException(ioe);
              }
          } else {
              notExpectedArgs = true;
          }
  
          if (!notExpectedArgs) {
              return this;
          } else {
              throw new JsonException("Expected no arguments, a single map, a single closure, or a map and closure as arguments.");
          }
      }