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