/** * Build the {@link Predicate} that determines whether a table identified by a given {@link TableId} is to be included. * * @return the table selection predicate; never null * @see #includeDatabases(String) * @see #excludeDatabases(String) * @see #includeTables(String) * @see #excludeTables(String) * @see #includeSchemas(String) * @see #excludeSchemas(String) */ public Predicate<TableId> build() { Predicate<TableId> tableFilter = tableInclusions != null ? tableInclusions : tableExclusions; Predicate<String> dbFilter = dbInclusions != null ? dbInclusions : dbExclusions; Predicate<String> schemaFilter = schemaInclusions != null ? schemaInclusions : schemaExclusions; if (dbFilter != null) { return buildStartingFromDbFilter(dbFilter, schemaFilter, tableFilter); } if (schemaFilter != null) { return buildStartingFromSchemaFilter(schemaFilter, tableFilter); } if (tableFilter != null) { return tableFilter; } return (id) -> true; }
/** * Build the {@link Predicate} that determines whether a table identified by a given {@link TableId} is to be included. * * @return the table selection predicate; never null * @see #includeDatabases(String) * @see #excludeDatabases(String) * @see #includeTables(String) * @see #excludeTables(String) * @see #includeSchemas(String) * @see #excludeSchemas(String) */ public Predicate<TableId> build() { Predicate<TableId> tableFilter = tableInclusions != null ? tableInclusions : tableExclusions; Predicate<String> dbFilter = dbInclusions != null ? dbInclusions : dbExclusions; Predicate<String> schemaFilter = schemaInclusions != null ? schemaInclusions : schemaExclusions; if (dbFilter != null) { return buildStartingFromDbFilter(dbFilter, schemaFilter, tableFilter); } if (schemaFilter != null) { return buildStartingFromSchemaFilter(schemaFilter, tableFilter); } if (tableFilter != null) { return tableFilter; } return (id) -> true; }