
net.vectorpublish.desktop.vp.api.conf.Config Maven / Gradle / Ivy
/*
* Copyright (c) 2016, Peter Rader. All rights reserved.
* ___ ___ __ ______ __ __ __ __
* | | |.-----..----.| |_ .-----..----.| __ \.--.--.| |--.| ||__|.-----.| |--.
* | | || -__|| __|| _|| _ || _|| __/| | || _ || || ||__ --|| |
* \_____/ |_____||____||____||_____||__| |___| |_____||_____||__||__||_____||__|__|
*
* http://www.gnu.org/licenses/gpl-3.0.html
*/
package net.vectorpublish.desktop.vp.api.conf;
import java.awt.Rectangle;
import net.vectorpublish.desktop.vp.ui.Namespace;
/**
* The configuration to store user-specific configuration values.
*/
public interface Config {
/**
* Returns the Rectangle.
*
* @param namespace
* The namespace the rectangles are stored.
* @param key
* The key of the rectangle.
* @return The rectangle stored or null
if no valid data was
* found at the namespace and key.
*/
Rectangle loadBounds(Namespace namespace, String key);
/**
* Returns the value from the configuration or null
if no such
* entry has been found or the value is indeed is null
.
*
* If the value is null
you will not know if the value is
* missing or really null
.
*
* Note, the {@link #storeBounds(Namespace, String, Rectangle)} will override
* .w
, .h
,.x
and .y
* values you specify.
*
* @param namespace
* The namespace to read from.
* @param key
* The key in the namespace.
* @return The string-value of the key.
*/
String read(Namespace namespace, String key);
/**
* Saves a Rectangle to the database.
*
* Note, the bounds will override x,y,w,h-values specified by
* {@link #read(Namespace, String)}.
*
* @param namespace
* The namespace to read from.
* @param key
* The key to read from.
* @param rectangle
* The rectangle you like to store.
*/
void storeBounds(Namespace namespace, String key, Rectangle rectangle);
/**
* Writes a value to the properties.
*
* Note, x,y,w,h will overwrite bounds stored to the key.
*
* @param namespace
* The namespace to write the value to.
* @param key
* The key to write the value to.
* @param value
* The value to write.
*/
void write(Namespace namespace, String key, String value);
}