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
.JsonGenerator
;
13 import com
.fasterxml
.jackson
.databind
.JsonSerializer
;
14 import com
.fasterxml
.jackson
.databind
.SerializerProvider
;
16 import de
.xn__ho_hia
.storage_unit
.StorageUnit
;
19 * Serializes a {@link StorageUnit} by unwrapping the enclosed {@link BigInteger} value.
21 public final class UnwrappingStorageUnitSerializer
extends JsonSerializer
<StorageUnit
<?
>> {
24 public void serialize(final StorageUnit
<?
> value
, final JsonGenerator jsonGenerator
,
25 final SerializerProvider serializers
)
27 jsonGenerator
.writeNumber(value
.inByte());