Commit 4b45e9d0 authored by Michael Ritter's avatar Michael Ritter
Browse files

Add the formatter to the IngestSummary

parent 3f8662d8
package edu.umiacs.ace.stats; package edu.umiacs.ace.stats;
import edu.umiacs.ace.util.FileSizeFormatter;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.sql.Timestamp; import java.sql.Timestamp;
...@@ -8,12 +10,13 @@ import java.sql.Timestamp; ...@@ -8,12 +10,13 @@ import java.sql.Timestamp;
* *
* Created by shake on 8/29/16. * Created by shake on 8/29/16.
*/ */
public final class IngestSummary { public class IngestSummary {
public final Timestamp date; public final Timestamp date;
public final String collection; public final String collection;
public final String group; public final String group;
public final Long count; public final Long count;
public final BigDecimal size; public final BigDecimal size;
private FileSizeFormatter formatter;
public IngestSummary(Timestamp date, String collection, String group, Long count, BigDecimal size) { public IngestSummary(Timestamp date, String collection, String group, Long count, BigDecimal size) {
this.date = date; this.date = date;
...@@ -42,4 +45,16 @@ public final class IngestSummary { ...@@ -42,4 +45,16 @@ public final class IngestSummary {
public BigDecimal getSize() { public BigDecimal getSize() {
return size; return size;
} }
public String getFormattedSize() {
if (formatter == null) {
return size + " Bytes";
}
return formatter.format(size);
}
public IngestSummary setFormatter(FileSizeFormatter formatter) {
this.formatter = formatter;
return this;
}
} }
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment