Project

General

Profile

1
package eu.dnetlib.dhp.common.report;
2

    
3
import eu.dnetlib.dhp.common.schemas.ReportEntry;
4
import eu.dnetlib.dhp.common.schemas.ReportEntryType;
5

    
6
/**
7
 * Factory of {@link ReportEntry} objects.
8
 * 
9
 * @author madryk
10
 */
11
public final class ReportEntryFactory {
12

    
13
    // ----------------------- CONSTRUCTORS -----------------------------
14
    
15
    private ReportEntryFactory() {}
16

    
17
    // ----------------------- LOGIC ------------------------------------
18
    
19
    /**
20
     * Creates {@link ReportEntry} with {@link ReportEntryType#COUNTER} type
21
     */
22
    public static ReportEntry createCounterReportEntry(String key, long count) {
23
        return new ReportEntry(key, ReportEntryType.COUNTER, String.valueOf(count));
24
    }
25
    
26
    /**
27
     * Creates {@link ReportEntry} with {@link ReportEntryType#DURATION} type
28
     */
29
    public static ReportEntry createDurationReportEntry(String key, long duration) {
30
        return new ReportEntry(key, ReportEntryType.DURATION, String.valueOf(duration));
31
    }
32
}
(1-1/2)