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 an AttributeValue.

Examples:

  • Method Details

    • transformFrom

      AttributeValue transformFrom(T input)
      Convert the provided Java object into an 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());
       
       
    • transformTo

      T transformTo(AttributeValue input)
      Convert the provided 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);
       
       
    • type

      EnhancedType<T> type()
      The type supported by this converter.
    • attributeValueType

      AttributeValueType attributeValueType()
      The AttributeValueType that a converter stores and reads values from DynamoDB via the AttributeValue class.