@ThreadSafe @Immutable public final class ZoneIdAttributeConverter extends Object implements AttributeConverter<ZoneId>
ZoneId
and AttributeValue
.
This stores and reads values in DynamoDB as a string using ZoneId.toString()
and ZoneId.of(String)
.
This can be created via create()
.
Modifier and Type | Field and Description |
---|---|
static ZoneIdStringConverter |
STRING_CONVERTER |
Constructor and Description |
---|
ZoneIdAttributeConverter() |
Modifier and Type | Method and Description |
---|---|
AttributeValueType |
attributeValueType()
The
AttributeValueType that a converter stores and reads values
from DynamoDB via the AttributeValue class. |
static ZoneIdAttributeConverter |
create() |
AttributeValue |
transformFrom(ZoneId input)
Convert the provided Java object into an
AttributeValue . |
ZoneId |
transformTo(AttributeValue input)
Convert the provided
AttributeValue into a Java object. |
EnhancedType<ZoneId> |
type()
The type supported by this converter.
|
public static final ZoneIdStringConverter STRING_CONVERTER
public static ZoneIdAttributeConverter create()
public EnhancedType<ZoneId> type()
AttributeConverter
type
in interface AttributeConverter<ZoneId>
public AttributeValueType attributeValueType()
AttributeConverter
AttributeValueType
that a converter stores and reads values
from DynamoDB via the AttributeValue
class.attributeValueType
in interface AttributeConverter<ZoneId>
public AttributeValue transformFrom(ZoneId 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<ZoneId>
public ZoneId 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<ZoneId>
Copyright © 2022. All rights reserved.