Class ConverterProvider
- java.lang.Object
-
- science.aist.neo4j.reflective.converter.ConverterProvider
-
public class ConverterProvider extends Object
Centralized class for providing DEFAULT converters. All converters in this provider will ALWAYS be applied per default. To use a different converter you can override with the @Converter annotaiton To prevent a field from converting simply add @Converter with the converter field NOT SET.- Since:
- 1.0
- Author:
- Oliver Krauss
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description class
ConverterProvider.ArrayRepresentative
-
Field Summary
Fields Modifier and Type Field Description static Class
ARRAY_CONVERTER_ID
-
Constructor Summary
Constructors Constructor Description ConverterProvider()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static FieldConverter
getConverter(Class fieldClass, Type type, Map<Class,Class<? extends FieldConverter>> converterOverrides)
Returns converter for classstatic Map<Class,Class<? extends FieldConverter>>
init(Map<Class,Class<? extends FieldConverter>> converterMap)
Init function provides converters.static Map<Class,Class<? extends FieldConverter>>
init(Map<Class,Class<? extends FieldConverter>> converterMap, boolean defaults)
Init function provides converters.
-
-
-
Field Detail
-
ARRAY_CONVERTER_ID
public static final Class ARRAY_CONVERTER_ID
-
-
Method Detail
-
init
public static Map<Class,Class<? extends FieldConverter>> init(Map<Class,Class<? extends FieldConverter>> converterMap)
Init function provides converters. ALWAYS provides a default, even without spring context. Can be overriden with Spring by supplying a converter map, or during runtime by using this function- Parameters:
converterMap
- to be provided instead of the hardcoded defaults- Returns:
- default converter map
-
init
public static Map<Class,Class<? extends FieldConverter>> init(Map<Class,Class<? extends FieldConverter>> converterMap, boolean defaults)
Init function provides converters. ALWAYS provides a default, even without spring context. Can be overriden with Spring by supplying a converter map, or during runtime by using this function- Parameters:
converterMap
- to be provided instead of the hardcoded defaultsdefaults
- if the default converter shall still be added (will NOT override anything in converterMap)- Returns:
- default converter map
-
getConverter
public static FieldConverter getConverter(Class fieldClass, Type type, Map<Class,Class<? extends FieldConverter>> converterOverrides)
Returns converter for class- Parameters:
fieldClass
- class that actually needs to be convertedtype
- generic type (optional) of fieldconverterOverrides
- overrides for (sub) classes that shall be returned in the converter hierarchy instead- Returns:
- converter (with possible sub-converters)
-
-