class RequestMethod {

  protected void validateType(final List<Object> parameters, final int index,
      final Class<?> clazz) {
    if (parameters.size() <= index) {
      throw new IllegalArgumentException(
          String.format("No parameter at index %d (expected: %s)%n", index, clazz));
    }

    final Object parameter = parameters.get(index);
    if (!clazz.isInstance(parameter)) {
      throw new IllegalArgumentException(String
          .format("Parameter at index %d is invalid (expected: %s, actual: %s)%n", index, clazz,
              parameter.getClass()));
    }
  }

}