Interface AttributeConverter<T>
-
- All Known Implementing Classes:
AtomicBooleanAttributeConverter,AtomicIntegerAttributeConverter,AtomicLongAttributeConverter,BigDecimalAttributeConverter,BigIntegerAttributeConverter,BooleanAttributeConverter,ByteArrayAttributeConverter,ByteAttributeConverter,ByteBufferAttributeConverter,CharacterArrayAttributeConverter,CharacterAttributeConverter,CharSequenceAttributeConverter,DocumentAttributeConverter,DoubleAttributeConverter,DurationAttributeConverter,EnumAttributeConverter,FloatAttributeConverter,InstantAsStringAttributeConverter,IntegerAttributeConverter,JsonItemAttributeConverter,ListAttributeConverter,LocalDateAttributeConverter,LocalDateTimeAttributeConverter,LocaleAttributeConverter,LocalTimeAttributeConverter,LongAttributeConverter,MapAttributeConverter,MonthDayAttributeConverter,OffsetDateTimeAsStringAttributeConverter,OptionalAttributeConverter,OptionalDoubleAttributeConverter,OptionalIntAttributeConverter,OptionalLongAttributeConverter,PeriodAttributeConverter,SdkBytesAttributeConverter,SdkNumberAttributeConverter,SetAttributeConverter,ShortAttributeConverter,StringAttributeConverter,StringBufferAttributeConverter,StringBuilderAttributeConverter,UriAttributeConverter,UrlAttributeConverter,UuidAttributeConverter,ZonedDateTimeAsStringAttributeConverter,ZoneIdAttributeConverter,ZoneOffsetAttributeConverter
@ThreadSafe public interface AttributeConverter<T>
Converts between a specific Java type and anAttributeValue.Examples:
- The
StringAttributeConverterconverts aStringinto a DynamoDB string (AttributeValue.s()). - The
InstantAsStringAttributeConverterconverts anInstantinto a DynamoDB string (AttributeValue.s()).
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description AttributeValueTypeattributeValueType()TheAttributeValueTypethat a converter stores and reads values from DynamoDB via theAttributeValueclass.AttributeValuetransformFrom(T input)Convert the provided Java object into anAttributeValue.TtransformTo(AttributeValue input)Convert the providedAttributeValueinto a Java object.EnhancedType<T>type()The type supported by this converter.
-
-
-
Method Detail
-
transformFrom
AttributeValue transformFrom(T input)
Convert the provided Java object into anAttributeValue. This will raise aRuntimeExceptionif 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());
-
transformTo
T transformTo(AttributeValue input)
Convert the providedAttributeValueinto a Java object. This will raise aRuntimeExceptionif 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);
-
type
EnhancedType<T> type()
The type supported by this converter.
-
attributeValueType
AttributeValueType attributeValueType()
TheAttributeValueTypethat a converter stores and reads values from DynamoDB via theAttributeValueclass.
-
-