Skip to content

Commit 0edd336

Browse files
iterators to get all integer, string, boolean, or structure map entries
Signed-off-by: Robert Grassian <robert.grassian@split.io>
1 parent cfc94c5 commit 0edd336

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

src/main/java/dev/openfeature/javasdk/EvaluationContext.java

+17
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
import java.time.ZonedDateTime;
77
import java.time.format.DateTimeFormatter;
88
import java.util.HashMap;
9+
import java.util.Iterator;
910
import java.util.Map;
1011

1112
@ToString @EqualsAndHashCode
@@ -39,6 +40,10 @@ public <T> T getStructureAttribute(String key, Class<T> klass) {
3940
return objMapper.readValue(val, klass);
4041
}
4142

43+
public Iterator<Map.Entry<String, String>> getStructureAttributes() {
44+
return jsonAttributes.entrySet().iterator();
45+
}
46+
4247
public void addStringAttribute(String key, String value) {
4348
stringAttributes.put(key, value);
4449
}
@@ -47,6 +52,10 @@ public String getStringAttribute(String key) {
4752
return stringAttributes.get(key);
4853
}
4954

55+
public Iterator<Map.Entry<String, String>> getStringAttributes() {
56+
return stringAttributes.entrySet().iterator();
57+
}
58+
5059
public void addIntegerAttribute(String key, Integer value) {
5160
integerAttributes.put(key, value);
5261
}
@@ -55,6 +64,10 @@ public Integer getIntegerAttribute(String key) {
5564
return integerAttributes.get(key);
5665
}
5766

67+
public Iterator<Map.Entry<String, Integer>> getIntegerAttributes() {
68+
return integerAttributes.entrySet().iterator();
69+
}
70+
5871
public Boolean getBooleanAttribute(String key) {
5972
return booleanAttributes.get(key);
6073
}
@@ -63,6 +76,10 @@ public void addBooleanAttribute(String key, Boolean b) {
6376
booleanAttributes.put(key, b);
6477
}
6578

79+
public Iterator<Map.Entry<String, Boolean>> getBooleanAttributes() {
80+
return booleanAttributes.entrySet().iterator();
81+
}
82+
6683
public void addDatetimeAttribute(String key, ZonedDateTime value) {
6784
this.stringAttributes.put(key, value.format(DateTimeFormatter.ISO_ZONED_DATE_TIME));
6885
}

0 commit comments

Comments
 (0)