@ThreadSafe @Immutable public final class UuidAttributeConverter extends Object implements AttributeConverter<UUID>
UUID and AttributeValue.
This supports storing and reading values in DynamoDB as a string.
| Modifier and Type | Field and Description |
|---|---|
static UuidStringConverter |
STRING_CONVERTER |
| Constructor and Description |
|---|
UuidAttributeConverter() |
| Modifier and Type | Method and Description |
|---|---|
AttributeValueType |
attributeValueType()
The
AttributeValueType that a converter stores and reads values
from DynamoDB via the AttributeValue class. |
static UuidAttributeConverter |
create() |
AttributeValue |
transformFrom(UUID input)
Convert the provided Java object into an
AttributeValue. |
UUID |
transformTo(AttributeValue input)
Convert the provided
AttributeValue into a Java object. |
EnhancedType<UUID> |
type()
The type supported by this converter.
|
public static final UuidStringConverter STRING_CONVERTER
public static UuidAttributeConverter create()
public EnhancedType<UUID> type()
AttributeConvertertype in interface AttributeConverter<UUID>public AttributeValueType attributeValueType()
AttributeConverterAttributeValueType that a converter stores and reads values
from DynamoDB via the AttributeValue class.attributeValueType in interface AttributeConverter<UUID>public AttributeValue transformFrom(UUID 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<UUID>public UUID 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<UUID>Copyright © 2023. All rights reserved.