/** * Factory for creating a new {@code ReportEntry} from a key-value pair. * * @param key the key under which the value should published; never * {@code null} or blank * @param value the value to publish; never {@code null} or blank */ public static ReportEntry from(String key, String value) { ReportEntry reportEntry = new ReportEntry(); reportEntry.add(key, value); return reportEntry; }
/** * Factory for creating a new {@code ReportEntry} from a map of key-value pairs. * * @param keyValuePairs the map of key-value pairs to be published; never * {@code null}; keys and values within entries in the map also must not be * {@code null} or blank */ public static ReportEntry from(Map<String, String> keyValuePairs) { Preconditions.notNull(keyValuePairs, "keyValuePairs must not be null"); ReportEntry reportEntry = new ReportEntry(); keyValuePairs.forEach(reportEntry::add); return reportEntry; }