diff --git a/bundles/org.openhab.core.persistence/src/main/java/org/openhab/core/persistence/PersistenceItemConfiguration.java b/bundles/org.openhab.core.persistence/src/main/java/org/openhab/core/persistence/PersistenceItemConfiguration.java index f548e12e56..4bbdf7e2b6 100644 --- a/bundles/org.openhab.core.persistence/src/main/java/org/openhab/core/persistence/PersistenceItemConfiguration.java +++ b/bundles/org.openhab.core.persistence/src/main/java/org/openhab/core/persistence/PersistenceItemConfiguration.java @@ -12,8 +12,8 @@ */ package org.openhab.core.persistence; -import java.util.Arrays; import java.util.List; +import java.util.Objects; import org.eclipse.jdt.annotation.NonNullByDefault; import org.eclipse.jdt.annotation.Nullable; @@ -30,15 +30,15 @@ public class PersistenceItemConfiguration { private final List items; private final @Nullable String alias; - private final @Nullable List strategies; - private final @Nullable List filters; + private final List strategies; + private final List filters; public PersistenceItemConfiguration(final List items, @Nullable final String alias, @Nullable final List strategies, @Nullable final List filters) { this.items = items; this.alias = alias; - this.strategies = strategies; - this.filters = filters; + this.strategies = Objects.requireNonNullElse(strategies, List.of()); + this.filters = Objects.requireNonNullElse(filters, List.of()); } public List getItems() { @@ -49,18 +49,17 @@ public class PersistenceItemConfiguration { return alias; } - public @Nullable List getStrategies() { + public List getStrategies() { return strategies; } - public @Nullable List getFilters() { + public List getFilters() { return filters; } @Override public String toString() { - return String.format("%s [items=%s, alias=%s, strategies=%s, filters=%s]", getClass().getSimpleName(), - Arrays.toString(items.toArray()), alias, Arrays.toString(strategies.toArray()), - Arrays.toString(filters.toArray())); + return String.format("%s [items=%s, alias=%s, strategies=%s, filters=%s]", getClass().getSimpleName(), items, + alias, strategies, filters); } }