@ThreadSafe @Immutable public final class CharacterAttributeConverter extends Object implements AttributeConverter<Character>, PrimitiveConverter<Character>
Character
and AttributeValue
.
This stores values in DynamoDB as a single-character string.
This only supports reading a single character from DynamoDB. Any string longer than 1 character will cause a RuntimeException during 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 CharacterAttributeConverter |
create() |
EnhancedType<Character> |
primitiveType()
The type supported by this converter.
|
AttributeValue |
transformFrom(Character input)
Convert the provided Java object into an
AttributeValue . |
Character |
transformTo(AttributeValue input)
Convert the provided
AttributeValue into a Java object. |
EnhancedType<Character> |
type()
The type supported by this converter.
|
public static CharacterAttributeConverter create()
public EnhancedType<Character> type()
AttributeConverter
type
in interface AttributeConverter<Character>
public AttributeValueType attributeValueType()
AttributeConverter
AttributeValueType
that a converter stores and reads values
from DynamoDB via the AttributeValue
class.attributeValueType
in interface AttributeConverter<Character>
public AttributeValue transformFrom(Character 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<Character>
public Character 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<Character>
public EnhancedType<Character> primitiveType()
PrimitiveConverter
primitiveType
in interface PrimitiveConverter<Character>
Copyright © 2021. All rights reserved.