extended interface: added keys() method
Signed-off-by: Stephan Richter <s.richter@srsoftware.de>
This commit is contained in:
@@ -9,7 +9,7 @@ object Meta {
|
|||||||
val COMPONENT_TYPE = "java" // "java" or "versionCatalog"
|
val COMPONENT_TYPE = "java" // "java" or "versionCatalog"
|
||||||
val GROUP = "de.srsoftware"
|
val GROUP = "de.srsoftware"
|
||||||
val ARTIFACT_ID = "configuration.api"
|
val ARTIFACT_ID = "configuration.api"
|
||||||
val VERSION = "1.0.1"
|
val VERSION = "1.0.2"
|
||||||
val PUBLISHING_TYPE = "AUTOMATIC" // USER_MANAGED or AUTOMATIC
|
val PUBLISHING_TYPE = "AUTOMATIC" // USER_MANAGED or AUTOMATIC
|
||||||
val SHA_ALGORITHMS = listOf("SHA-256", "SHA-512") // sha256 and sha512 are supported but not mandatory. Only sha1 is mandatory but it is supported by default.
|
val SHA_ALGORITHMS = listOf("SHA-256", "SHA-512") // sha256 and sha512 are supported but not mandatory. Only sha1 is mandatory but it is supported by default.
|
||||||
val DESC = "SRSoftware Configuration API"
|
val DESC = "SRSoftware Configuration API"
|
||||||
|
|||||||
@@ -2,6 +2,7 @@
|
|||||||
package de.srsoftware.configuration;
|
package de.srsoftware.configuration;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
import java.util.Collection;
|
||||||
import java.util.Optional;
|
import java.util.Optional;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -35,6 +36,12 @@ public interface Configuration {
|
|||||||
*/
|
*/
|
||||||
<T> T get(String key, T defaultValue);
|
<T> T get(String key, T defaultValue);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the configuration`s key set
|
||||||
|
* @return a collection of strings which are the keys to the configuration
|
||||||
|
*/
|
||||||
|
Collection<String> keys();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Assign a specific key with a new value. If the key was assigned with another value before, the old value is overwritten
|
* Assign a specific key with a new value. If the key was assigned with another value before, the old value is overwritten
|
||||||
* @param key specifies, which value is to be assigned
|
* @param key specifies, which value is to be assigned
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ object Meta {
|
|||||||
val COMPONENT_TYPE = "java" // "java" or "versionCatalog"
|
val COMPONENT_TYPE = "java" // "java" or "versionCatalog"
|
||||||
val GROUP = "de.srsoftware"
|
val GROUP = "de.srsoftware"
|
||||||
val ARTIFACT_ID = "configuration.json"
|
val ARTIFACT_ID = "configuration.json"
|
||||||
val VERSION = "1.0.2"
|
val VERSION = "1.0.3"
|
||||||
val PUBLISHING_TYPE = "AUTOMATIC" // USER_MANAGED or AUTOMATIC
|
val PUBLISHING_TYPE = "AUTOMATIC" // USER_MANAGED or AUTOMATIC
|
||||||
val SHA_ALGORITHMS = listOf("SHA-256", "SHA-512") // sha256 and sha512 are supported but not mandatory. Only sha1 is mandatory but it is supported by default.
|
val SHA_ALGORITHMS = listOf("SHA-256", "SHA-512") // sha256 and sha512 are supported but not mandatory. Only sha1 is mandatory but it is supported by default.
|
||||||
val DESC = "SRSoftware Configuration: Json-based Implementation"
|
val DESC = "SRSoftware Configuration: Json-based Implementation"
|
||||||
|
|||||||
@@ -130,6 +130,11 @@ public class JsonConfig implements Configuration {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Collection<String> keys() {
|
||||||
|
return json.keySet();
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* updates the storage file with the current json data
|
* updates the storage file with the current json data
|
||||||
* @throws IOException if writing the file does so
|
* @throws IOException if writing the file does so
|
||||||
|
|||||||
Reference in New Issue
Block a user