Skip to content

Commit de50535

Browse files
committed
Add getBigInteger method to BinaryJSONObject for type-safe retrieval
1 parent f8ea3d6 commit de50535

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

src/main/java/io/pwrlabs/utils/BinaryJSONObject.java

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -191,6 +191,15 @@ public BinaryJSONArray getBinaryJSONArray(String key) {
191191
}
192192
}
193193

194+
public BigInteger getBigInteger(String key) {
195+
Object value = get(key);
196+
if(value instanceof BigInteger) {
197+
return (BigInteger) value;
198+
} else {
199+
throw new IllegalArgumentException("Value is not a BigInteger");
200+
}
201+
}
202+
194203
public boolean containsKey(String key) {
195204
return keyValueMap.containsKey(key);
196205
}

0 commit comments

Comments
 (0)