diff --git a/scm-core/src/main/java/sonia/scm/store/ConfigurationStore.java b/scm-core/src/main/java/sonia/scm/store/ConfigurationStore.java
index a7f21dd304..bcdc0443ca 100644
--- a/scm-core/src/main/java/sonia/scm/store/ConfigurationStore.java
+++ b/scm-core/src/main/java/sonia/scm/store/ConfigurationStore.java
@@ -33,6 +33,10 @@
package sonia.scm.store;
+import java.util.Optional;
+
+import static java.util.Optional.ofNullable;
+
/**
* ConfigurationStore for configuration objects. Note: the default
* implementation use JAXB to marshall the configuration objects.
@@ -50,7 +54,17 @@ public interface ConfigurationStore
*
* @return configuration object from store
*/
- public T get();
+ T get();
+
+ /**
+ * Returns the configuration object from store.
+ *
+ *
+ * @return configuration object from store
+ */
+ default Optional getOptional() {
+ return ofNullable(get());
+ }
//~--- set methods ----------------------------------------------------------
@@ -60,5 +74,5 @@ public interface ConfigurationStore
*
* @param obejct configuration object to store
*/
- public void set(T obejct);
+ void set(T object);
}
diff --git a/scm-core/src/main/java/sonia/scm/store/MultiEntryStore.java b/scm-core/src/main/java/sonia/scm/store/MultiEntryStore.java
index 9a35cee0e0..c1a8863758 100644
--- a/scm-core/src/main/java/sonia/scm/store/MultiEntryStore.java
+++ b/scm-core/src/main/java/sonia/scm/store/MultiEntryStore.java
@@ -32,6 +32,10 @@
package sonia.scm.store;
+import java.util.Optional;
+
+import static java.util.Optional.ofNullable;
+
/**
* Base class for {@link BlobStore} and {@link DataStore}.
*
@@ -67,4 +71,16 @@ public interface MultiEntryStore {
* @return item with the given id
*/
public T get(String id);
+
+ /**
+ * Returns the item with the given id from the store.
+ *
+ *
+ * @param id id of the item to return
+ *
+ * @return item with the given id
+ */
+ default Optional getOptional(String id) {
+ return ofNullable(get(id));
+ }
}