All Downloads are FREE. Search and download functionalities are using the official Maven repository.

no.difi.certvalidator.util.SimpleReport Maven / Gradle / Ivy

There is a newer version: 2.2.1
Show newest version
package no.difi.certvalidator.util;

import no.difi.certvalidator.api.Property;
import no.difi.certvalidator.api.Report;

import java.util.HashMap;
import java.util.Map;
import java.util.Set;

/**
 * @author erlend
 */
public class SimpleReport implements Report {

    private final Map values;

    public static Report newInstance() {
        return new SimpleReport();
    }

    private SimpleReport() {
        this(new HashMap());
    }

    private SimpleReport(Map values) {
        this.values = values;
    }

    @Override
    public  boolean contains(Property key) {
        return values.containsKey(key);
    }

    @Override
    public  void set(Property key, T value) {
        values.put(key, value);
    }

    @Override
    @SuppressWarnings("unchecked")
    public  T get(Property key) {
        return (T) values.get(key);
    }

    @Override
    public Set keys() {
        return values.keySet();
    }

    @Override
    public Report copy() {
        return new SimpleReport(new HashMap<>(values));
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy