@Test public void testPersistedFormat() throws IOException { persistence.persist( ImmutableList.<FileSupplier>of( makeFileSupplier(OutputFile.FilterType.DENSITY, "xxhdpi")), writer); assertEquals("[{\"filterType\":\"DENSITY\",\"filterIdentifier\":\"xxhdpi\",\"splitFileName\":\"DENSITY_xxhdpi\"}]", writer.toString()); }
public void persist(List<FileSupplier> fileSuppliers, Writer writer) throws IOException { Gson gson = new Gson(); ImmutableList.Builder<Record> records = ImmutableList.builder(); for (FileSupplier fileSupplier : fileSuppliers) { if (fileSupplier instanceof SplitFileSupplier) { records.add(new Record( ((SplitFileSupplier) fileSupplier).getFilterData().getFilterType(), ((SplitFileSupplier) fileSupplier).getFilterData().getIdentifier(), fileSupplier.get().getName())); } } String recordsAsString = gson.toJson(records.build()); try { writer.append(recordsAsString); } finally { writer.close(); } }
FilterDataPersistence { public void persist(List<FileSupplier> fileSuppliers, Writer writer) throws IOException { Gson gson = new Gson(); ImmutableList.Builder<Record> records = ImmutableList.builder(); for (FileSupplier fileSupplier : fileSuppliers) { if (fileSupplier instanceof SplitFileSupplier) { records.add(new Record( ((SplitFileSupplier) fileSupplier).getFilterData().getFilterType(), ((SplitFileSupplier) fileSupplier).getFilterData().getIdentifier(), fileSupplier.get().getName())); } } String recordsAsString = gson.toJson(records.build()); try { writer.append(recordsAsString); } finally { writer.close(); } } }
FilterDataPersistence { public void persist(List<FileSupplier> fileSuppliers, Writer writer) throws IOException { Gson gson = new Gson(); ImmutableList.Builder<Record> records = ImmutableList.builder(); for (FileSupplier fileSupplier : fileSuppliers) { if (fileSupplier instanceof SplitFileSupplier) { records.add(new Record( ((SplitFileSupplier) fileSupplier).getFilterData().getFilterType(), ((SplitFileSupplier) fileSupplier).getFilterData().getIdentifier(), fileSupplier.get().getName())); } } String recordsAsString = gson.toJson(records.build()); try { writer.append(recordsAsString); } finally { writer.close(); } }  }
FilterDataPersistence { public void persist(List<FileSupplier> fileSuppliers, Writer writer) throws IOException { Gson gson = new Gson(); ImmutableList.Builder<Record> records = ImmutableList.builder(); for (FileSupplier fileSupplier : fileSuppliers) { if (fileSupplier instanceof SplitFileSupplier) { records.add(new Record( ((SplitFileSupplier) fileSupplier).getFilterData().getFilterType(), ((SplitFileSupplier) fileSupplier).getFilterData().getIdentifier(), fileSupplier.get().getName())); } } String recordsAsString = gson.toJson(records.build()); try { writer.append(recordsAsString); } finally { writer.close(); } }  void persist(List<FileSupplier> fileSuppliers, Writer writer); List<Record> load(Reader reader); }
FilterDataPersistence { public void persist(List<FileSupplier> fileSuppliers, Writer writer) throws IOException { Gson gson = new Gson(); ImmutableList.Builder<Record> records = ImmutableList.builder(); for (FileSupplier fileSupplier : fileSuppliers) { if (fileSupplier instanceof SplitFileSupplier) { records.add(new Record( ((SplitFileSupplier) fileSupplier).getFilterData().getFilterType(), ((SplitFileSupplier) fileSupplier).getFilterData().getIdentifier(), fileSupplier.get().getName())); } } String recordsAsString = gson.toJson(records.build()); try { writer.append(recordsAsString); } finally { writer.close(); } }  void persist(List<FileSupplier> fileSuppliers, Writer writer); List<Record> load(Reader reader);  }