@ThreadSafe @Immutable public final class DoubleAttributeConverter extends Object implements AttributeConverter<Double>, PrimitiveConverter<Double>
Double and AttributeValue.
This stores values in DynamoDB as a number.
This supports converting numbers stored in DynamoDB into a double-precision floating point number, within the range
Double.MIN_VALUE, Double.MAX_VALUE. For less precision or smaller values, consider using
FloatAttributeConverter. For greater precision or larger values, consider using BigDecimalAttributeConverter.
If values are known to be whole numbers, it is recommended to use a perfect-precision whole number representation like those
provided by ShortAttributeConverter, IntegerAttributeConverter or BigIntegerAttributeConverter.
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 DoubleAttributeConverter |
create() |
EnhancedType<Double> |
primitiveType()
The type supported by this converter.
|
AttributeValue |
transformFrom(Double input)
Convert the provided Java object into an
AttributeValue. |
Double |
transformTo(AttributeValue input)
Convert the provided
AttributeValue into a Java object. |
EnhancedType<Double> |
type()
The type supported by this converter.
|
public static DoubleAttributeConverter create()
public EnhancedType<Double> type()
AttributeConvertertype in interface AttributeConverter<Double>public AttributeValueType attributeValueType()
AttributeConverterAttributeValueType that a converter stores and reads values
from DynamoDB via the AttributeValue class.attributeValueType in interface AttributeConverter<Double>public AttributeValue transformFrom(Double 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<Double>public Double 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<Double>public EnhancedType<Double> primitiveType()
PrimitiveConverterprimitiveType in interface PrimitiveConverter<Double>Copyright © 2023. All rights reserved.