Fix null annotations on PersistenceItemConfiguration (#2876)
Signed-off-by: Jan N. Klug <github@klug.nrw>pull/2879/head
parent
f20799b69b
commit
5629a38e1a
|
@ -12,8 +12,8 @@
|
||||||
*/
|
*/
|
||||||
package org.openhab.core.persistence;
|
package org.openhab.core.persistence;
|
||||||
|
|
||||||
import java.util.Arrays;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Objects;
|
||||||
|
|
||||||
import org.eclipse.jdt.annotation.NonNullByDefault;
|
import org.eclipse.jdt.annotation.NonNullByDefault;
|
||||||
import org.eclipse.jdt.annotation.Nullable;
|
import org.eclipse.jdt.annotation.Nullable;
|
||||||
|
@ -30,15 +30,15 @@ public class PersistenceItemConfiguration {
|
||||||
|
|
||||||
private final List<PersistenceConfig> items;
|
private final List<PersistenceConfig> items;
|
||||||
private final @Nullable String alias;
|
private final @Nullable String alias;
|
||||||
private final @Nullable List<PersistenceStrategy> strategies;
|
private final List<PersistenceStrategy> strategies;
|
||||||
private final @Nullable List<PersistenceFilter> filters;
|
private final List<PersistenceFilter> filters;
|
||||||
|
|
||||||
public PersistenceItemConfiguration(final List<PersistenceConfig> items, @Nullable final String alias,
|
public PersistenceItemConfiguration(final List<PersistenceConfig> items, @Nullable final String alias,
|
||||||
@Nullable final List<PersistenceStrategy> strategies, @Nullable final List<PersistenceFilter> filters) {
|
@Nullable final List<PersistenceStrategy> strategies, @Nullable final List<PersistenceFilter> filters) {
|
||||||
this.items = items;
|
this.items = items;
|
||||||
this.alias = alias;
|
this.alias = alias;
|
||||||
this.strategies = strategies;
|
this.strategies = Objects.requireNonNullElse(strategies, List.of());
|
||||||
this.filters = filters;
|
this.filters = Objects.requireNonNullElse(filters, List.of());
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<PersistenceConfig> getItems() {
|
public List<PersistenceConfig> getItems() {
|
||||||
|
@ -49,18 +49,17 @@ public class PersistenceItemConfiguration {
|
||||||
return alias;
|
return alias;
|
||||||
}
|
}
|
||||||
|
|
||||||
public @Nullable List<PersistenceStrategy> getStrategies() {
|
public List<PersistenceStrategy> getStrategies() {
|
||||||
return strategies;
|
return strategies;
|
||||||
}
|
}
|
||||||
|
|
||||||
public @Nullable List<PersistenceFilter> getFilters() {
|
public List<PersistenceFilter> getFilters() {
|
||||||
return filters;
|
return filters;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return String.format("%s [items=%s, alias=%s, strategies=%s, filters=%s]", getClass().getSimpleName(),
|
return String.format("%s [items=%s, alias=%s, strategies=%s, filters=%s]", getClass().getSimpleName(), items,
|
||||||
Arrays.toString(items.toArray()), alias, Arrays.toString(strategies.toArray()),
|
alias, strategies, filters);
|
||||||
Arrays.toString(filters.toArray()));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue