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

org.yestech.publish.objectmodel.PublisherProperties Maven / Gradle / Ivy

Go to download

Framework to publish ascii or binary data to different sources. Currently Episodic, Bitgravity, Local, Cloudfs, and S3 are supported

There is a newer version: 1.1.0
Show newest version
/*
 * Copyright LGPL3
 * YES Technology Association
 * http://yestech.org
 *
 * http://www.opensource.org/licenses/lgpl-3.0.html
 */

/*
 *
 * Author:  Artie Copeland
 * Last Modified Date: $DateTime: $
 */
package org.yestech.publish.objectmodel;

import static com.google.common.collect.Maps.newHashMap;

import java.util.Map;

import org.yestech.lib.util.Pair;

/**
 * Container for properties used by {@link org.yestech.publish.publisher.IPublisher}
 * 
 * @author Artie Copeland
 * @version $Revision: $
 */
@SuppressWarnings("unchecked")
public class PublisherProperties {
    private Map> properties;

    public PublisherProperties() {
        properties = newHashMap();
    }

    public Map> getProperties() {
        return properties;
    }

    public void setProperties(Map> properties) {
        this.properties = properties;
    }

    public  V getProperty(Pair key) {
        Map typeProperties = getTypeProperties(key);
        return (V) typeProperties.get(key.getSecond());
    }

    private Map getTypeProperties(Pair key) {
        Map typeProperties = properties.get(key.getFirst());
        if (typeProperties == null) {
            typeProperties = newHashMap();
            properties.put(key.getFirst(), typeProperties);
        }
        return typeProperties;
    }

    public void addProperty(Pair key, Object value) {
        Map typeProperties = getTypeProperties(key);
        typeProperties.put(key.getSecond(), value);
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy