Class ConverterResolver
java.lang.Object
cz.cvut.kbss.jopa.model.metamodel.ConverterResolver
Determines potential converters which may be used on a field.
Currently, only built-in converters for data and annotation property attributes are supported, but in the future, custom converters should be also supported.
-
Method Summary
Modifier and TypeMethodDescriptionstatic ConverterWrapper<?,
?> createCustomConverter
(Class<?> converterType) void
registerConverter
(Class<?> attributeType, ConverterWrapper<?, ?> converter) Registers the specified converter for automatically converting values to the specified attribute type.Optional<ConverterWrapper<?,
?>> resolveConverter
(Type<?> type) Alternative method for resolving converter.static Class<?>
resolveConverterAttributeType
(Class<?> converterType)
-
Method Details
-
createCustomConverter
-
resolveConverterAttributeType
-
resolveConverter
Alternative method for resolving converter. Can be used when the persistent attribute type is not relevant and/or the classPropertyAttributes
is not used for attribute configuration, e.g. for attributes defined by a query.Determines converter which should be used for transformation of values to and from the specified type of field.
Beside custom converters, the system supports a number of built-in converters, which ensure that e.g. widening conversion or mapping to Java 8 Date/Time API is supported.
-
registerConverter
Registers the specified converter for automatically converting values to the specified attribute type.- Parameters:
attributeType
- Entity attribute type to convert to/fromconverter
- Converter instance
-