Class DefaultConverterRegistry
java.lang.Object
com.hybris.backoffice.cockpitng.json.impl.DefaultConverterRegistry
- All Implemented Interfaces:
ConverterRegistry,MutableConverterRegistry
Default implementation of registry for
Converter.-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprotected static class -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescription<S,D> void addConverter(Converter<S, D> converter, Class<? extends S> source, Class<? extends D> destination) Registers new converter as a way of converting particular type into other.<S,T> Converter<S, T> getConverterForSource(Class<? extends S> sourceClass) Looks for converter able to convert objects from provided type<S,T> Converter<S, T> getConverterForTarget(Class<? extends T> targetClass) Looks for converter able to convert objects to provided typegetConverterParameters(Converter<S, T> converter) Gets source and target types of provided converter<S,T> Class<S> getSourceClass(Class<? extends T> targetClass) Looks for source type that is assigned for provided.<S,T> Class<T> getTargetClass(Class<? extends S> sourceClass) Looks for target type that is assigned for provided.voidsetRegistry(Map<org.apache.commons.lang3.tuple.Pair<Class, Class>, Converter> registry)
-
Constructor Details
-
DefaultConverterRegistry
public DefaultConverterRegistry()
-
-
Method Details
-
getConverterParameters
public <S,T> org.apache.commons.lang3.tuple.Pair<Class<S>,Class<T>> getConverterParameters(Converter<S, T> converter) Description copied from interface:ConverterRegistryGets source and target types of provided converter- Specified by:
getConverterParametersin interfaceConverterRegistry- Type Parameters:
S- type of sourceT- type of target- Parameters:
converter- converter to be checked- Returns:
- <source, target> of provided converter; one, both or none side of result may be set
-
getSourceClass
Description copied from interface:ConverterRegistryLooks for source type that is assigned for provided.- Specified by:
getSourceClassin interfaceConverterRegistry- Type Parameters:
S- type of sourceT- type of target- Parameters:
targetClass- source object type- Returns:
- source class for provided target or
nullif no converter was found for specified target
-
getConverterForTarget
Description copied from interface:ConverterRegistryLooks for converter able to convert objects to provided type- Specified by:
getConverterForTargetin interfaceConverterRegistry- Type Parameters:
S- type of sourceT- type of target- Parameters:
targetClass- target object type- Returns:
- converter able to convert objects to provided type or
nullif no converter was found for specified target
-
getTargetClass
Description copied from interface:ConverterRegistryLooks for target type that is assigned for provided.- Specified by:
getTargetClassin interfaceConverterRegistry- Type Parameters:
S- type of sourceT- type of target- Parameters:
sourceClass- source object type- Returns:
- target class for provided source or
nullif no converter was found for specified source
-
getConverterForSource
Description copied from interface:ConverterRegistryLooks for converter able to convert objects from provided type- Specified by:
getConverterForSourcein interfaceConverterRegistry- Type Parameters:
S- type of sourceT- type of target- Parameters:
sourceClass- source object type- Returns:
- converter able to convert objects from provided type or
nullif no converter was found for specified source
-
getRegistry
-
setRegistry
-
addConverter
public <S,D> void addConverter(Converter<S, D> converter, Class<? extends S> source, Class<? extends D> destination) Description copied from interface:MutableConverterRegistryRegisters new converter as a way of converting particular type into other.If any other converter was already registered for provided conversion pair, it will be overwritten.
- Specified by:
addConverterin interfaceMutableConverterRegistry- Type Parameters:
S- type of source objectD- type of target object- Parameters:
converter- converter to be registeredsource- conversion source typedestination- conversion target class
-