remove unnecessary JsonProcessingException
[storage-units.git] / storage-units-jackson / src / main / java / de / xn__ho_hia / storage_unit / jackson / UnwrappingStorageUnitSerializer.java
blobc0fefa9d9b403c580ab46a9acb0af536a0cd791e
1 /*
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
5 * in the LICENSE file.
6 */
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;
18 /**
19 * Serializes a {@link StorageUnit} by unwrapping the enclosed {@link BigInteger} value.
21 public final class UnwrappingStorageUnitSerializer extends JsonSerializer<StorageUnit<?>> {
23 @Override
24 public void serialize(final StorageUnit<?> value, final JsonGenerator jsonGenerator,
25 final SerializerProvider serializers)
26 throws IOException {
27 jsonGenerator.writeNumber(value.inByte());