diff --git a/openmessaging-api/src/main/java/io/openmessaging/KeyValue.java b/openmessaging-api/src/main/java/io/openmessaging/KeyValue.java
index f9ea4a28..2cfb650a 100644
--- a/openmessaging-api/src/main/java/io/openmessaging/KeyValue.java
+++ b/openmessaging-api/src/main/java/io/openmessaging/KeyValue.java
@@ -34,6 +34,15 @@
* @since OMS 1.0.0
*/
public interface KeyValue {
+
+ /**
+ * Inserts or replaces {@code boolean} value for the specified key.
+ *
+ * @param key the key to be placed into this {@code KeyValue} object
+ * @param value the value corresponding to key
+ */
+ KeyValue put(String key, boolean value);
+
/**
* Inserts or replaces {@code short} value for the specified key.
*
@@ -74,6 +83,27 @@ public interface KeyValue {
*/
KeyValue put(String key, String value);
+ /**
+ * Searches for the {@code boolean} property with the specified key in this {@code KeyValue} object. If the key is not
+ * found in this property list, false is returned.
+ *
+ * @param key the property key
+ * @return the value in this {@code KeyValue} object with the specified key value
+ * @see #put(String, boolean)
+ */
+ boolean getBoolean(String key);
+
+ /**
+ * Searches for the {@code boolean} property with the specified key in this {@code KeyValue} object. If the key is not
+ * found in this property list, false is returned.
+ *
+ * @param key the property key
+ * @param defaultValue a default value
+ * @return the value in this {@code KeyValue} object with the specified key value
+ * @see #put(String, boolean)
+ */
+ boolean getBoolean(String key, boolean defaultValue);
+
/**
* Searches for the {@code short} property with the specified key in this {@code KeyValue} object. If the key is not
* found in this property list, zero is returned.
diff --git a/openmessaging-api/src/main/java/io/openmessaging/internal/DefaultKeyValue.java b/openmessaging-api/src/main/java/io/openmessaging/internal/DefaultKeyValue.java
index be121b9b..952e17c6 100644
--- a/openmessaging-api/src/main/java/io/openmessaging/internal/DefaultKeyValue.java
+++ b/openmessaging-api/src/main/java/io/openmessaging/internal/DefaultKeyValue.java
@@ -31,6 +31,25 @@
public class DefaultKeyValue implements KeyValue {
private Map properties;
+ @Override
+ public KeyValue put(String key, boolean value) {
+ properties.put(key, String.valueOf(value));
+ return this;
+ }
+
+ @Override
+ public boolean getBoolean(String key) {
+ if (!properties.containsKey(key)) {
+ return false;
+ }
+ return Boolean.valueOf(properties.get(key));
+ }
+
+ @Override
+ public boolean getBoolean(String key, boolean defaultValue) {
+ return properties.containsKey(key) ? getBoolean(key) : defaultValue;
+ }
+
@Override
public short getShort(String key) {
if (!properties.containsKey(key)) {