diff options
Diffstat (limited to 'id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/config/persistence/MOAIDConfiguration.java')
-rw-r--r-- | id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/config/persistence/MOAIDConfiguration.java | 62 |
1 files changed, 62 insertions, 0 deletions
diff --git a/id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/config/persistence/MOAIDConfiguration.java b/id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/config/persistence/MOAIDConfiguration.java new file mode 100644 index 000000000..45f37ef97 --- /dev/null +++ b/id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/config/persistence/MOAIDConfiguration.java @@ -0,0 +1,62 @@ +package at.gv.egovernment.moa.id.commons.config.persistence; + +import java.util.List; + +import at.gv.egiz.components.configuration.api.Configuration; + +/** + * An interface for a key-value configuration. + */ +public interface MOAIDConfiguration { + + /** + * Gets all keys in the database. NOTE: may return an empty list or {@code null}. + * @return a List containing all keys in the database or {@code null}. + */ + List<String> getAllKeys(); + + /** + * Get the value associated with the given key as {@link Object}. + * @param key the key + * @return the String associated with the given key or {@code null} if the key does not exist or does not have a value. + */ + String get(String key); + + /** + * Get the object of type {@code T} associated with the given key. + * + * @param key the key + * @param clazz the type of the requested object + * @return the object associated with the given key or {@code null} if the key does not exist or does not have a value. + */ + <T> T get(String key, Class<T> clazz); + + /** + * Store an object associated with a key. If the given object is set to {@code null} then the entry associated with the key is deleted. + * + * @param key the key under which the value is stored, respectively key determining the entry to be deleted. + * @param value the String to store. if value is set to {@code null} then the entry associated with key {@code key} is deleted. + * @return {@code true} if the operation was carried out successfully, {@code false} otherwise. + */ + boolean set(String key, String value); +// +// /** +// * Get the object of type {@code T} associated with the given key from the database. If the key does not exist or does not have a value, the given default +// * value is returned. +// * +// * @param key the key +// * @param clazz the type of the requested object +// * @param defaultValue the default value to return +// * @return the object associated with the given key or {@code defaultValue} if the key does not exist or does not have a value. +// */ +// <T> T get(String key, Class<T> clazz, Object defaultValue); +// +// /** +// * Get a list of objects associated with the given key. The list may be empty or contain only a single object. +// * @param key the key +// * @param clazz the type of the requested object +// * @return a list containing objects of type {@code T} or an empty list if no objects are associated with the key. +// */ +// <T> List<T> getList(String key, Class<T> clazz); + +}
\ No newline at end of file |