@ThreadSafe @Immutable public final class BigIntegerAttributeConverter extends Object implements AttributeConverter<BigInteger>
BigInteger
and AttributeValue
.
This stores values in DynamoDB as a number.
This supports reading the full range of integers supported by DynamoDB. For smaller numbers, consider using
ShortAttributeConverter
, IntegerAttributeConverter
or LongAttributeConverter
.
This does not support reading decimal numbers. For decimal numbers, consider using FloatAttributeConverter
,
DoubleAttributeConverter
or BigDecimalAttributeConverter
. Decimal numbers will cause a
NumberFormatException
on conversion.
This can be created via create()
.
Modifier and Type | Method and Description |
---|---|
AttributeValueType |
attributeValueType()
The
AttributeValueType that a converter stores and reads values
from DynamoDB via the AttributeValue class. |
static BigIntegerAttributeConverter |
create() |
AttributeValue |
transformFrom(BigInteger input)
Convert the provided Java object into an
AttributeValue . |
BigInteger |
transformTo(AttributeValue input)
Convert the provided
AttributeValue into a Java object. |
EnhancedType<BigInteger> |
type()
The type supported by this converter.
|
public static BigIntegerAttributeConverter create()
public EnhancedType<BigInteger> type()
AttributeConverter
type
in interface AttributeConverter<BigInteger>
public AttributeValueType attributeValueType()
AttributeConverter
AttributeValueType
that a converter stores and reads values
from DynamoDB via the AttributeValue
class.attributeValueType
in interface AttributeConverter<BigInteger>
public AttributeValue transformFrom(BigInteger input)
AttributeConverter
AttributeValue
. This will raise a RuntimeException
if the
conversion fails, or the input is null.
Example:
InstantAsStringAttributeConverter converter = InstantAsStringAttributeConverter.create();
assertEquals(converter.transformFrom(Instant.EPOCH),
EnhancedAttributeValue.fromString("1970-01-01T00:00:00Z").toAttributeValue());
transformFrom
in interface AttributeConverter<BigInteger>
public BigInteger transformTo(AttributeValue input)
AttributeConverter
AttributeValue
into a Java object. This will raise a RuntimeException
if the
conversion fails, or the input is null.
Example:
InstantAsStringAttributeConverter converter = InstantAsStringAttributeConverter.create();
assertEquals(converter.transformTo(EnhancedAttributeValue.fromString("1970-01-01T00:00:00Z").toAttributeValue()),
Instant.EPOCH);
transformTo
in interface AttributeConverter<BigInteger>
Copyright © 2021. All rights reserved.