try {
Collection<Filter> includes = new ArrayList<Filter>();
Collection<Filter> excludes = new ArrayList<Filter>();
if (cmd.contains(schemasArg)) {
String spec = withIndirection(cmd.getArg(schemasArg).getValue());
includes.add(new FilterParser(spec).parseSchemaFilter());
}
if (cmd.contains(tablesArg)) {
String spec = withIndirection(cmd.getArg(tablesArg).getValue());
includes.add(new FilterParser(spec).parseTableFilter(true));
}
if (cmd.contains(columnsArg)) {
String spec = withIndirection(cmd.getArg(columnsArg).getValue());
includes.add(new FilterParser(spec).parseColumnFilter(true));
}
if (cmd.contains(skipSchemasArg)) {
String spec = withIndirection(cmd.getArg(skipSchemasArg).getValue());
excludes.add(new FilterParser(spec).parseSchemaFilter());
}
if (cmd.contains(skipTablesArg)) {
String spec = withIndirection(cmd.getArg(skipTablesArg).getValue());
excludes.add(new FilterParser(spec).parseTableFilter(false));
}
if (cmd.contains(skipColumnsArg)) {
String spec = withIndirection(cmd.getArg(skipColumnsArg).getValue());
excludes.add(new FilterParser(spec).parseColumnFilter(false));
}
if (!includes.isEmpty() || !excludes.isEmpty()) {
loader.setFilter(new FilterIncludeExclude(
includes.isEmpty() ? Filter.ALL : FilterMatchAny.create(includes),
FilterMatchAny.create(excludes)));