public abstract class TypeConvertingVisitor<T> extends Object
EnhancedAttributeValue.
This is useful in AttributeConverter implementations, without having to write a switch statement on the
EnhancedAttributeValue.type().
| Modifier and Type | Field and Description |
|---|---|
protected Class<?> |
targetType |
| Modifier | Constructor and Description |
|---|---|
protected |
TypeConvertingVisitor(Class<?> targetType)
Called by subclasses to provide enhanced logging when a specific type isn't handled.
|
protected |
TypeConvertingVisitor(Class<?> targetType,
Class<?> converterClass)
Called by subclasses to provide enhanced logging when a specific type isn't handled.
|
| Modifier and Type | Method and Description |
|---|---|
T |
convert(EnhancedAttributeValue value)
Convert the provided value into the target type.
|
T |
convertBoolean(Boolean value)
Invoked when visiting an attribute in which
EnhancedAttributeValue.isBoolean() is true. |
T |
convertBytes(SdkBytes value)
Invoked when visiting an attribute in which
EnhancedAttributeValue.isBytes() is true. |
T |
convertListOfAttributeValues(List<AttributeValue> value)
Invoked when visiting an attribute in which
EnhancedAttributeValue.isListOfAttributeValues() is true. |
T |
convertMap(Map<String,AttributeValue> value)
Invoked when visiting an attribute in which
EnhancedAttributeValue.isMap() is true. |
T |
convertNull()
Invoked when visiting an attribute in which
EnhancedAttributeValue.isNull() is true. |
T |
convertNumber(String value)
Invoked when visiting an attribute in which
EnhancedAttributeValue.isNumber() is true. |
T |
convertSetOfBytes(List<SdkBytes> value)
Invoked when visiting an attribute in which
EnhancedAttributeValue.isSetOfBytes() is true. |
T |
convertSetOfNumbers(List<String> value)
Invoked when visiting an attribute in which
EnhancedAttributeValue.isSetOfNumbers() is true. |
T |
convertSetOfStrings(List<String> value)
Invoked when visiting an attribute in which
EnhancedAttributeValue.isSetOfStrings() is true. |
T |
convertString(String value)
Invoked when visiting an attribute in which
EnhancedAttributeValue.isString() is true. |
T |
defaultConvert(AttributeValueType type,
Object value)
This is invoked by default if a different "convert" method is not overridden.
|
protected final Class<?> targetType
protected TypeConvertingVisitor(Class<?> targetType)
Reasons this call may fail with a RuntimeException:
targetType - The type to which this visitor is converting.protected TypeConvertingVisitor(Class<?> targetType, Class<?> converterClass)
Reasons this call may fail with a RuntimeException:
targetType - The type to which this visitor is converting.converterClass - The converter implementation that is creating this visitor. This may be null.public final T convert(EnhancedAttributeValue value)
Reasons this call may fail with a RuntimeException:
public T convertNull()
EnhancedAttributeValue.isNull() is true.public T convertMap(Map<String,AttributeValue> value)
EnhancedAttributeValue.isMap() is true. The provided value is the
underlying value of the EnhancedAttributeValue being converted.public T convertString(String value)
EnhancedAttributeValue.isString() is true. The provided value is the
underlying value of the EnhancedAttributeValue being converted.public T convertNumber(String value)
EnhancedAttributeValue.isNumber() is true. The provided value is the
underlying value of the EnhancedAttributeValue being converted.public T convertBytes(SdkBytes value)
EnhancedAttributeValue.isBytes() is true. The provided value is the
underlying value of the EnhancedAttributeValue being converted.public T convertBoolean(Boolean value)
EnhancedAttributeValue.isBoolean() is true. The provided value is the
underlying value of the EnhancedAttributeValue being converted.public T convertSetOfStrings(List<String> value)
EnhancedAttributeValue.isSetOfStrings() is true. The provided value is
the underlying value of the EnhancedAttributeValue being converted.public T convertSetOfNumbers(List<String> value)
EnhancedAttributeValue.isSetOfNumbers() is true. The provided value is
the underlying value of the EnhancedAttributeValue being converted.public T convertSetOfBytes(List<SdkBytes> value)
EnhancedAttributeValue.isSetOfBytes() is true. The provided value is
the underlying value of the EnhancedAttributeValue being converted.public T convertListOfAttributeValues(List<AttributeValue> value)
EnhancedAttributeValue.isListOfAttributeValues() is true. The provided
value is the underlying value of the EnhancedAttributeValue being converted.public T defaultConvert(AttributeValueType type, Object value)
type - The type that wasn't handled by another "convert" method.value - The value that wasn't handled by another "convert" method.Copyright © 2023. All rights reserved.