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