mirror of
https://github.com/danieldemus/openhab-core.git
synced 2025-01-26 20:21:33 +01:00
[persistence] Handle null
value for relative
& inverted
props of filters (#3727)
Signed-off-by: Florian Hotze <florianh_dev@icloud.com>
This commit is contained in:
parent
e1741cf61d
commit
f5a0b37b3d
@ -15,6 +15,7 @@ package org.openhab.core.persistence.filter;
|
|||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
|
|
||||||
import org.eclipse.jdt.annotation.NonNullByDefault;
|
import org.eclipse.jdt.annotation.NonNullByDefault;
|
||||||
|
import org.eclipse.jdt.annotation.Nullable;
|
||||||
import org.openhab.core.items.Item;
|
import org.openhab.core.items.Item;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -29,10 +30,10 @@ public class PersistenceEqualsFilter extends PersistenceFilter {
|
|||||||
private final Collection<String> values;
|
private final Collection<String> values;
|
||||||
private final boolean inverted;
|
private final boolean inverted;
|
||||||
|
|
||||||
public PersistenceEqualsFilter(String name, Collection<String> values, boolean inverted) {
|
public PersistenceEqualsFilter(String name, Collection<String> values, @Nullable Boolean inverted) {
|
||||||
super(name);
|
super(name);
|
||||||
this.values = values;
|
this.values = values;
|
||||||
this.inverted = inverted;
|
this.inverted = (inverted == null) ? false : inverted;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Collection<String> getValues() {
|
public Collection<String> getValues() {
|
||||||
|
@ -40,12 +40,12 @@ public class PersistenceIncludeFilter extends PersistenceFilter {
|
|||||||
private final boolean inverted;
|
private final boolean inverted;
|
||||||
|
|
||||||
public PersistenceIncludeFilter(String name, BigDecimal lower, BigDecimal upper, @Nullable String unit,
|
public PersistenceIncludeFilter(String name, BigDecimal lower, BigDecimal upper, @Nullable String unit,
|
||||||
boolean inverted) {
|
@Nullable Boolean inverted) {
|
||||||
super(name);
|
super(name);
|
||||||
this.lower = lower;
|
this.lower = lower;
|
||||||
this.upper = upper;
|
this.upper = upper;
|
||||||
this.unit = (unit == null) ? "" : unit;
|
this.unit = (unit == null) ? "" : unit;
|
||||||
this.inverted = inverted;
|
this.inverted = (inverted == null) ? false : inverted;
|
||||||
}
|
}
|
||||||
|
|
||||||
public BigDecimal getLower() {
|
public BigDecimal getLower() {
|
||||||
|
@ -48,11 +48,12 @@ public class PersistenceThresholdFilter extends PersistenceFilter {
|
|||||||
|
|
||||||
private final transient Map<String, State> valueCache = new HashMap<>();
|
private final transient Map<String, State> valueCache = new HashMap<>();
|
||||||
|
|
||||||
public PersistenceThresholdFilter(String name, BigDecimal value, @Nullable String unit, boolean relative) {
|
public PersistenceThresholdFilter(String name, BigDecimal value, @Nullable String unit,
|
||||||
|
@Nullable Boolean relative) {
|
||||||
super(name);
|
super(name);
|
||||||
this.value = value;
|
this.value = value;
|
||||||
this.unit = (unit == null) ? "" : unit;
|
this.unit = (unit == null) ? "" : unit;
|
||||||
this.relative = relative;
|
this.relative = (relative == null) ? false : relative;
|
||||||
}
|
}
|
||||||
|
|
||||||
public BigDecimal getValue() {
|
public BigDecimal getValue() {
|
||||||
|
Loading…
Reference in New Issue
Block a user