2 * This file is part of storage-units. It is subject to the license terms in the LICENSE file found in the top-level
3 * directory of this distribution and at http://creativecommons.org/publicdomain/zero/1.0/. No part of storage-units,
4 * including this file, may be copied, modified, propagated, or distributed except according to the terms contained
7 package de
.xn__ho_hia
.storage_unit
.jackson
;
9 import java
.io
.IOException
;
10 import java
.math
.BigInteger
;
12 import com
.fasterxml
.jackson
.core
.JsonParser
;
13 import com
.fasterxml
.jackson
.databind
.DeserializationContext
;
14 import com
.fasterxml
.jackson
.databind
.JsonDeserializer
;
16 import org
.eclipse
.jdt
.annotation
.NonNull
;
18 import de
.xn__ho_hia
.quality
.null_analysis
.Nullsafe
;
19 import de
.xn__ho_hia
.storage_unit
.StorageUnit
;
20 import de
.xn__ho_hia
.storage_unit
.StorageUnits
;
23 * Deserializes value back into decimal storage units.
25 public final class DecimalStorageUnitDeserializer
extends JsonDeserializer
<StorageUnit
<?
>> {
28 public StorageUnit
<?
> deserialize(final JsonParser jsonParser
, final DeserializationContext context
)
31 final BigInteger value
= Nullsafe
.nonNull(jsonParser
.getBigIntegerValue());
32 return StorageUnits
.decimalValueOf(value
);