bump version to 1.8.3 in pom.xml and add getValues method to AgentContext for improved value retrieval
This commit is contained in:
2
pom.xml
2
pom.xml
@@ -4,7 +4,7 @@
|
||||
<artifactId>lm-lib</artifactId>
|
||||
<groupId>de.extio</groupId>
|
||||
<name>lm-lib</name>
|
||||
<version>1.8.2</version>
|
||||
<version>1.8.3</version>
|
||||
|
||||
<properties>
|
||||
<java.version>21</java.version>
|
||||
|
||||
@@ -120,6 +120,14 @@ public final class AgentContext {
|
||||
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) {
|
||||
if (value == null) {
|
||||
this.context.remove(key);
|
||||
|
||||
Reference in New Issue
Block a user