@ThreadSafe @Immutable public final class ByteArrayAttributeConverter extends Object implements AttributeConverter<byte[]>
byte[] and AttributeValue.
This stores values in DynamoDB as a binary blob.
This supports reading every byte value supported by DynamoDB, making it fully compatible with custom converters as
well as internal converters (e.g. SdkBytesAttributeConverter).
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 ByteArrayAttributeConverter |
create() |
AttributeValue |
transformFrom(byte[] input)
Convert the provided Java object into an
AttributeValue. |
byte[] |
transformTo(AttributeValue input)
Convert the provided
AttributeValue into a Java object. |
EnhancedType<byte[]> |
type()
The type supported by this converter.
|
public static ByteArrayAttributeConverter create()
public EnhancedType<byte[]> type()
AttributeConvertertype in interface AttributeConverter<byte[]>public AttributeValueType attributeValueType()
AttributeConverterAttributeValueType that a converter stores and reads values
from DynamoDB via the AttributeValue class.attributeValueType in interface AttributeConverter<byte[]>public AttributeValue transformFrom(byte[] 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<byte[]>public byte[] 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<byte[]>Copyright © 2020. All rights reserved.