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().
-
Field Summary
Fields -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedTypeConvertingVisitor(Class<?> targetType) Called by subclasses to provide enhanced logging when a specific type isn't handled.protectedTypeConvertingVisitor(Class<?> targetType, Class<?> converterClass) Called by subclasses to provide enhanced logging when a specific type isn't handled. -
Method Summary
Modifier and TypeMethodDescriptionfinal Tconvert(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.
-
Field Details
-
targetType
-
-
Constructor Details
-
TypeConvertingVisitor
Called by subclasses to provide enhanced logging when a specific type isn't handled.Reasons this call may fail with a
RuntimeException:- If the provided type is null.
- Parameters:
targetType- The type to which this visitor is converting.
-
TypeConvertingVisitor
Called by subclasses to provide enhanced logging when a specific type isn't handled.Reasons this call may fail with a
RuntimeException:- If the provided type is null.
- Parameters:
targetType- The type to which this visitor is converting.converterClass- The converter implementation that is creating this visitor. This may be null.
-
-
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 theEnhancedAttributeValuebeing converted. -
convertString
Invoked when visiting an attribute in whichEnhancedAttributeValue.isString()is true. The provided value is the underlying value of theEnhancedAttributeValuebeing converted. -
convertNumber
Invoked when visiting an attribute in whichEnhancedAttributeValue.isNumber()is true. The provided value is the underlying value of theEnhancedAttributeValuebeing converted. -
convertBytes
Invoked when visiting an attribute in whichEnhancedAttributeValue.isBytes()is true. The provided value is the underlying value of theEnhancedAttributeValuebeing converted. -
convertBoolean
Invoked when visiting an attribute in whichEnhancedAttributeValue.isBoolean()is true. The provided value is the underlying value of theEnhancedAttributeValuebeing converted. -
convertSetOfStrings
Invoked when visiting an attribute in whichEnhancedAttributeValue.isSetOfStrings()is true. The provided value is the underlying value of theEnhancedAttributeValuebeing converted. -
convertSetOfNumbers
Invoked when visiting an attribute in whichEnhancedAttributeValue.isSetOfNumbers()is true. The provided value is the underlying value of theEnhancedAttributeValuebeing converted. -
convertSetOfBytes
Invoked when visiting an attribute in whichEnhancedAttributeValue.isSetOfBytes()is true. The provided value is the underlying value of theEnhancedAttributeValuebeing converted. -
convertListOfAttributeValues
Invoked when visiting an attribute in whichEnhancedAttributeValue.isListOfAttributeValues()is true. The provided value is the underlying value of theEnhancedAttributeValuebeing 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.
-