bump version to 1.8.3 in pom.xml and add getValues method to AgentContext for improved value retrieval

This commit is contained in:
extio-de
2025-10-31 16:33:42 +01:00
parent bd37a143f6
commit ae322743d6
2 changed files with 9 additions and 1 deletions

View File

@@ -4,7 +4,7 @@
<artifactId>lm-lib</artifactId> <artifactId>lm-lib</artifactId>
<groupId>de.extio</groupId> <groupId>de.extio</groupId>
<name>lm-lib</name> <name>lm-lib</name>
<version>1.8.2</version> <version>1.8.3</version>
<properties> <properties>
<java.version>21</java.version> <java.version>21</java.version>

View File

@@ -120,6 +120,14 @@ public final class AgentContext {
throw new IllegalArgumentException("Value for key '" + key + "' is not of type " + type.getName()); throw new IllegalArgumentException("Value for key '" + key + "' is not of type " + type.getName());
} }
public <T> List<T> getValues(final String key, final Class<T> type) {
final var values = this.context.get(key);
if (values == null) {
return null;
}
return values.stream().map(type::cast).collect(Collectors.toCollection(ArrayList::new));
}
public <T> void setValue(final String key, final T value) { public <T> void setValue(final String key, final T value) {
if (value == null) { if (value == null) {
this.context.remove(key); this.context.remove(key);