@ThreadSafe @Immutable public final class ByteAttributeConverter extends Object implements AttributeConverter<Byte>, PrimitiveConverter<Byte>
Byte and AttributeValue.
This stores values in DynamoDB as a single byte.
This only supports reading a single byte from DynamoDB. Any binary data greater than 1 byte will cause a RuntimeException during conversion.
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 ByteAttributeConverter |
create() |
EnhancedType<Byte> |
primitiveType()
The type supported by this converter.
|
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 ByteAttributeConverter create()
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>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 EnhancedType<Byte> primitiveType()
PrimitiveConverterprimitiveType in interface PrimitiveConverter<Byte>Copyright © 2022. All rights reserved.