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