Class TypeConvertingVisitor<T>
java.lang.Object
software.amazon.awssdk.enhanced.dynamodb.internal.converter.TypeConvertingVisitor<T>
A visitor across all possible types of a
EnhancedAttributeValue
.
This is useful in AttributeConverter
implementations, without having to write a switch statement on the
EnhancedAttributeValue.type()
.
- See Also:
-
Method Summary
Modifier and TypeMethodDescriptionfinal T
convert
(EnhancedAttributeValue value) Convert the provided value into the target type.convertBoolean
(Boolean value) Invoked when visiting an attribute in whichEnhancedAttributeValue.isBoolean()
is true.convertBytes
(SdkBytes value) Invoked when visiting an attribute in whichEnhancedAttributeValue.isBytes()
is true.Invoked when visiting an attribute in whichEnhancedAttributeValue.isListOfAttributeValues()
is true.convertMap
(Map<String, AttributeValue> value) Invoked when visiting an attribute in whichEnhancedAttributeValue.isMap()
is true.Invoked when visiting an attribute in whichEnhancedAttributeValue.isNull()
is true.convertNumber
(String value) Invoked when visiting an attribute in whichEnhancedAttributeValue.isNumber()
is true.convertSetOfBytes
(List<SdkBytes> value) Invoked when visiting an attribute in whichEnhancedAttributeValue.isSetOfBytes()
is true.convertSetOfNumbers
(List<String> value) Invoked when visiting an attribute in whichEnhancedAttributeValue.isSetOfNumbers()
is true.convertSetOfStrings
(List<String> value) Invoked when visiting an attribute in whichEnhancedAttributeValue.isSetOfStrings()
is true.convertString
(String value) Invoked when visiting an attribute in whichEnhancedAttributeValue.isString()
is true.defaultConvert
(AttributeValueType type, Object value) This is invoked by default if a different "convert" method is not overridden.
-
Method Details
-
convert
Convert the provided value into the target type.Reasons this call may fail with a
RuntimeException
:- If the value cannot be converted by this visitor.
-
convertNull
Invoked when visiting an attribute in whichEnhancedAttributeValue.isNull()
is true. -
convertMap
Invoked when visiting an attribute in whichEnhancedAttributeValue.isMap()
is true. The provided value is the underlying value of theEnhancedAttributeValue
being converted. -
convertString
Invoked when visiting an attribute in whichEnhancedAttributeValue.isString()
is true. The provided value is the underlying value of theEnhancedAttributeValue
being converted. -
convertNumber
Invoked when visiting an attribute in whichEnhancedAttributeValue.isNumber()
is true. The provided value is the underlying value of theEnhancedAttributeValue
being converted. -
convertBytes
Invoked when visiting an attribute in whichEnhancedAttributeValue.isBytes()
is true. The provided value is the underlying value of theEnhancedAttributeValue
being converted. -
convertBoolean
Invoked when visiting an attribute in whichEnhancedAttributeValue.isBoolean()
is true. The provided value is the underlying value of theEnhancedAttributeValue
being converted. -
convertSetOfStrings
Invoked when visiting an attribute in whichEnhancedAttributeValue.isSetOfStrings()
is true. The provided value is the underlying value of theEnhancedAttributeValue
being converted. -
convertSetOfNumbers
Invoked when visiting an attribute in whichEnhancedAttributeValue.isSetOfNumbers()
is true. The provided value is the underlying value of theEnhancedAttributeValue
being converted. -
convertSetOfBytes
Invoked when visiting an attribute in whichEnhancedAttributeValue.isSetOfBytes()
is true. The provided value is the underlying value of theEnhancedAttributeValue
being converted. -
convertListOfAttributeValues
Invoked when visiting an attribute in whichEnhancedAttributeValue.isListOfAttributeValues()
is true. The provided value is the underlying value of theEnhancedAttributeValue
being converted. -
defaultConvert
This is invoked by default if a different "convert" method is not overridden. By default, this throws an exception.- Parameters:
type
- The type that wasn't handled by another "convert" method.value
- The value that wasn't handled by another "convert" method.
-