Class DefaultConverterManager
java.lang.Object
dev.voidframework.core.conversion.impl.DefaultConverterManager
- All Implemented Interfaces:
ConverterManager
Default implementation of
ConverterManager.-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionintcount()Returns the number of registered converters.<S,T> TypeConverter<S, T> getConverter(Class<S> sourceClassType, Class<T> targetClassType) Returns whether the Manager have converter for the given input / output type.<S,T> boolean hasConvertFor(Class<S> sourceClassType, Class<T> targetClassType) Returns whether the Manager have converter for the given input / output type.voidregisterConverter(Class<?> sourceClassType, Class<?> targetClassType, TypeConverter<?, ?> converter) Register converter.
-
Constructor Details
-
DefaultConverterManager
public DefaultConverterManager()Build a new instance.
-
-
Method Details
-
hasConvertFor
Description copied from interface:ConverterManagerReturns whether the Manager have converter for the given input / output type.- Specified by:
hasConvertForin interfaceConverterManager- Type Parameters:
S- The source generic typeT- The target generic type- Parameters:
sourceClassType- The source type classtargetClassType- The target type class- Returns:
trueif the manager has a matching converter, otherwisefalse
-
registerConverter
public void registerConverter(Class<?> sourceClassType, Class<?> targetClassType, TypeConverter<?, ?> converter) Description copied from interface:ConverterManagerRegister converter.- Specified by:
registerConverterin interfaceConverterManager- Parameters:
sourceClassType- The source type classtargetClassType- The target type classconverter- The converter
-
getConverter
Description copied from interface:ConverterManagerReturns whether the Manager have converter for the given input / output type.- Specified by:
getConverterin interfaceConverterManager- Type Parameters:
S- The source generic typeT- The target generic type- Parameters:
sourceClassType- The source type classtargetClassType- The target type class- Returns:
- The requested converter
-
count
public int count()Description copied from interface:ConverterManagerReturns the number of registered converters.- Specified by:
countin interfaceConverterManager- Returns:
- The number of registered converters
-