mirror of
https://github.com/danieldemus/openhab-core.git
synced 2025-01-25 19:55:48 +01:00
Re-introduce removed DecimalType ctors to maintain compatibility (#2803)
Signed-off-by: Jan N. Klug <github@klug.nrw>
This commit is contained in:
parent
c267e8f876
commit
f79d85da87
@ -49,6 +49,20 @@ public class DecimalType extends Number implements PrimitiveType, State, Command
|
||||
this(bigDecimal(value));
|
||||
}
|
||||
|
||||
// TODO: Remove these constructors. They are still in place to maintain binary compatibility and will be removed
|
||||
// once another change breaking binary compatibility is merged
|
||||
public DecimalType(BigDecimal value) {
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
public DecimalType(long value) {
|
||||
this(bigDecimal(value));
|
||||
}
|
||||
|
||||
public DecimalType(double value) {
|
||||
this(bigDecimal(value));
|
||||
}
|
||||
|
||||
private static BigDecimal bigDecimal(Number value) {
|
||||
if (value instanceof QuantityType) {
|
||||
return ((QuantityType<?>) value).toBigDecimal();
|
||||
@ -61,10 +75,6 @@ public class DecimalType extends Number implements PrimitiveType, State, Command
|
||||
return new BigDecimal(value.toString());
|
||||
}
|
||||
|
||||
public DecimalType(BigDecimal value) {
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a new {@link DecimalType} with the given value.
|
||||
* The English locale is used to determine (decimal/grouping) separator characters.
|
||||
|
Loading…
Reference in New Issue
Block a user