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

biz.paluch.logging.gelf.Values Maven / Gradle / Ivy

There is a newer version: 1.15.1
Show newest version
package biz.paluch.logging.gelf;

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

/**
 * Value object to abstract multiple values mapped by a {@link String} key.
 *
 * @author Mark Paluch
 * @since 28.02.14 09:50
 */
public class Values {

    private Map values = new HashMap<>();

    public Values() {
    }

    public Values(String name, Object value) {
        if (name != null && value != null) {
            values.put(name, value);
        }
    }

    public boolean hasValues() {
        return ! values.isEmpty();
    }

    public int size() {
        return values.size();
    }

    public Set getEntryNames() {
        return Collections.unmodifiableSet(values.keySet());
    }

    public void setValue(String key, Object value) {
        values.put(key, value);
    }

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




© 2015 - 2024 Weber Informatics LLC | Privacy Policy