org.yestech.publish.objectmodel.PublisherProperties Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of yespublish Show documentation
Show all versions of yespublish Show documentation
Framework to publish ascii or binary data
to different sources. Currently Episodic, Bitgravity, Local, Cloudfs,
and S3 are supported
/*
* 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);
}
}