class DataConverter {

    public List<Object[]> convert(Object data, boolean isVarargs, Class<?>[] parameterTypes, ConverterContext context) {
        checkNotNull(parameterTypes, "'parameterTypes' must not be null");
        checkArgument(parameterTypes.length != 0, "'parameterTypes' must not be empty");

        if (data instanceof Object[][]) {
            return convert((Object[][]) data, isVarargs, parameterTypes, context);

        } else if (data instanceof String[]) {
            checkState(context != null, "'context' must not be null for 'String[]' data");
            return convert((String[]) data, isVarargs, parameterTypes, context);

        } else if (data instanceof Object[]) {
            return convert((Object[]) data, isVarargs, parameterTypes, context);

        } else if (data instanceof Iterable) {
            @SuppressWarnings("rawtypes")
            Iterable iterableData = (Iterable) data;
            return convert(iterableData, isVarargs, parameterTypes, context);
        }
        throw new ClassCastException(
                String.format("Cannot cast to either Object[][], Object[], String[], or Iterable because data was: %s", data));
    }

}