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