@ThreadSafe @Immutable public final class SdkNumberAttributeConverter extends Object implements AttributeConverter<SdkNumber>
SdkNumber 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 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 SdkNumberAttributeConverter |
create() |
AttributeValue |
transformFrom(SdkNumber input)
Convert the provided Java object into an
AttributeValue. |
SdkNumber |
transformTo(AttributeValue input)
Convert the provided
AttributeValue into a Java object. |
EnhancedType<SdkNumber> |
type()
The type supported by this converter.
|
public static SdkNumberAttributeConverter create()
public EnhancedType<SdkNumber> type()
AttributeConvertertype in interface AttributeConverter<SdkNumber>public AttributeValueType attributeValueType()
AttributeConverterAttributeValueType that a converter stores and reads values
from DynamoDB via the AttributeValue class.attributeValueType in interface AttributeConverter<SdkNumber>public AttributeValue transformFrom(SdkNumber input)
AttributeConverterAttributeValue. 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<SdkNumber>public SdkNumber transformTo(AttributeValue input)
AttributeConverterAttributeValue 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<SdkNumber>Copyright © 2023. All rights reserved.