[core] Make logger in QuantityType transient (#1652)

This makes QuantityType serialisable

Fixes #1651

Signed-off-by: Kai Kreuzer <kai@openhab.org>
This commit is contained in:
Kai Kreuzer 2020-09-19 09:57:42 +02:00 committed by GitHub
parent 5919f923d5
commit fa18610d77
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -55,7 +55,6 @@ import tec.uom.se.quantity.Quantities;
// annotated.
public class QuantityType<T extends Quantity<T>> extends Number
implements PrimitiveType, State, Command, Comparable<QuantityType<T>> {
private final Logger logger = LoggerFactory.getLogger(QuantityType.class);
private static final long serialVersionUID = 8828949721938234629L;
private static final BigDecimal HUNDRED = BigDecimal.valueOf(100);
@ -69,12 +68,14 @@ public class QuantityType<T extends Quantity<T>> extends Number
// The later would be an exponent from the scalar value.
private static final String UNIT_PATTERN = "(?<=\\d)\\s*(?=[a-zA-Z°µ%'](?![\\+\\-]?\\d))";
private final Quantity<T> quantity;
static {
UnitInitializer.init();
}
private transient final Logger logger = LoggerFactory.getLogger(QuantityType.class);
private final Quantity<T> quantity;
/**
* Creates a dimensionless {@link QuantityType} with scalar 0 and unit {@link AbstractUnit#ONE}.
* A default constructor is needed by {@link org.openhab.core.internal.items.ItemUpdater#receiveUpdate})