forked from sqlancer/sqlancer
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathAbstractTables.java
More file actions
37 lines (28 loc) · 959 Bytes
/
AbstractTables.java
File metadata and controls
37 lines (28 loc) · 959 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
package sqlancer.common.schema;
import java.util.ArrayList;
import java.util.List;
import java.util.function.Function;
import java.util.stream.Collectors;
public class AbstractTables<T extends AbstractTable<C, ?, ?>, C extends AbstractTableColumn<?, ?>> {
private final List<T> tables;
private final List<C> columns;
public AbstractTables(List<T> tables) {
this.tables = tables;
columns = new ArrayList<>();
for (T t : tables) {
columns.addAll(t.getColumns());
}
}
public String tableNamesAsString() {
return tables.stream().map(t -> t.getName()).collect(Collectors.joining(", "));
}
public List<T> getTables() {
return tables;
}
public List<C> getColumns() {
return columns;
}
public String columnNamesAsString(Function<C, String> function) {
return getColumns().stream().map(function).collect(Collectors.joining(", "));
}
}