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