Iterable<String> directories = splitter.split(table.getTablePackage()); File file = directory; for (String d : directories) { pw.println(" */"); if (!table.getTablePackage().isEmpty()) { pw.println("package " + table.getTablePackage() + ";");
Pair<String, String> mainP = Pair.of(main.getTablePackage(), main.getTableName()); Map<Pair<String, String>, SymbolTable> toWrite = new HashMap<>(); for (SymbolTable st : libraries) { Pair<String, String> p = Pair.of(st.getTablePackage(), st.getTableName()); if (p.equals(mainP)) { continue; st = main.filter(st).rename(st.getTablePackage(), st.getTableName()); toWrite.put(k, st);
/** * Merges a list of tables into a single table. The merge is order-sensitive: when multiple * symbols with the same class / name exist in multiple tables, the first one will be used. * * @param tables the tables to merge * @return the table with the result of the merge; this table will have the package / name of * the first table in {@code tables}, or the default one if there are no tables in * {@code tables} */ @NonNull public static SymbolTable merge(@NonNull List<SymbolTable> tables) { SymbolTable.Builder builder = SymbolTable.builder(); boolean first = true; for (SymbolTable t : tables) { if (first) { builder.tablePackage(t.getTablePackage()); builder.tableName(t.getTableName()); first = false; } for (Symbol s : t.allSymbols()) { if (!builder.contains(s)) { builder.add(s); } } } return builder.build(); }