public class CustomConversions extends Object
Types that can be mapped directly onto JSON are considered simple ones, because they neither need deeper inspection nor nested conversion.
| Constructor and Description |
|---|
CustomConversions(List<?> converters,
SimpleTypeHolder simpleTypeHolder)
Create a new instance with a given list of conversers.
|
| Modifier and Type | Method and Description |
|---|---|
Class<?> |
getCustomWriteTarget(Class<?> sourceType)
Returns the target type to convert to in case we have a custom conversion registered to convert the given source
type into a Aerospike native one.
|
Class<?> |
getCustomWriteTarget(Class<?> sourceType,
Class<?> requestedTargetType)
Returns the target type we can write an object of the given source type to.
|
SimpleTypeHolder |
getSimpleTypeHolder()
Returns the simple type holder.
|
boolean |
hasCustomReadTarget(Class<?> sourceType,
Class<?> requestedTargetType)
Returns whether we have a custom conversion registered to read the given source into the given target type.
|
boolean |
hasCustomWriteTarget(Class<?> sourceType)
Returns whether we have a custom conversion registered to write into a Aerospike native type.
|
boolean |
hasCustomWriteTarget(Class<?> sourceType,
Class<?> requestedTargetType)
Returns whether we have a custom conversion registered to write an object of the given source type into an object
of the given Aerospike native target type.
|
boolean |
isSimpleType(Class<?> type)
Check that the given type is of "simple type".
|
void |
registerConvertersIn(GenericConversionService conversionService)
Populates the given
GenericConversionService with the convertes registered. |
public CustomConversions(List<?> converters, SimpleTypeHolder simpleTypeHolder)
converters - the list of custom converters.simpleTypeHolder - public boolean isSimpleType(Class<?> type)
type - the type to check.public SimpleTypeHolder getSimpleTypeHolder()
public void registerConvertersIn(GenericConversionService conversionService)
GenericConversionService with the convertes registered.conversionService - the service to register.public Class<?> getCustomWriteTarget(Class<?> sourceType)
sourceType - must not be nullpublic Class<?> getCustomWriteTarget(Class<?> sourceType, Class<?> requestedTargetType)
expectedTargetType is null we will simply return the
first target type matching or null if no conversion can be found.sourceType - must not be nullrequestedTargetType - public boolean hasCustomWriteTarget(Class<?> sourceType)
sourceType - must not be nullpublic boolean hasCustomWriteTarget(Class<?> sourceType, Class<?> requestedTargetType)
sourceType - must not be null.requestedTargetType - public boolean hasCustomReadTarget(Class<?> sourceType, Class<?> requestedTargetType)
sourceType - must not be nullrequestedTargetType - must not be nullCopyright © 2012–2020 Aerospike, Inc. All rights reserved.