Class DefaultConversion
java.lang.Object
dev.voidframework.core.conversion.impl.DefaultConversion
- All Implemented Interfaces:
Conversion
Default implementation of
Conversion.-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescription<SOURCE_TYPE,TARGET_TYPE>
booleancanConvert(Class<SOURCE_TYPE> sourceTypeClass, Class<TARGET_TYPE> targetTypeClass) Returns whether the given source type can be converted to the given target type.<TARGET_TYPE>
booleancanConvert(Object object, Class<TARGET_TYPE> targetTypeClass) Returns whether the given object can be converted to the given target type.<SOURCE_TYPE,TARGET_TYPE>
List<TARGET_TYPE>convert(Iterable<SOURCE_TYPE> objectIterable, Class<SOURCE_TYPE> sourceTypeClass, Class<TARGET_TYPE> targetTypeClass) Converts each object from a set to the target type.<SOURCE_TYPE,TARGET_TYPE>
List<TARGET_TYPE>Converts each object from an iterable to the target type.<SOURCE_TYPE,TARGET_TYPE>
List<TARGET_TYPE>convert(List<SOURCE_TYPE> objectList, Class<SOURCE_TYPE> sourceTypeClass, Class<TARGET_TYPE> targetTypeClass) Converts each object from a list to the target type.<SOURCE_TYPE,TARGET_TYPE>
List<TARGET_TYPE>Converts each object from a list to the target type.<SOURCE_TYPE,TARGET_TYPE>
Set<TARGET_TYPE>convert(Set<SOURCE_TYPE> objectSet, Class<SOURCE_TYPE> sourceTypeClass, Class<TARGET_TYPE> targetTypeClass) Converts each object from a set to the target type.<SOURCE_TYPE,TARGET_TYPE>
Set<TARGET_TYPE>Converts each object from a set to the target type.<SOURCE_TYPE,TARGET_TYPE>
TARGET_TYPEConverts an object to the target type.<SOURCE_TYPE,TARGET_TYPE>
TARGET_TYPEConverts an object to the target type.
-
Constructor Details
-
DefaultConversion
Build a new instance.- Parameters:
converterManager- Instance of the Converter Manager
-
-
Method Details
-
canConvert
public <SOURCE_TYPE,TARGET_TYPE> boolean canConvert(Class<SOURCE_TYPE> sourceTypeClass, Class<TARGET_TYPE> targetTypeClass) Description copied from interface:ConversionReturns whether the given source type can be converted to the given target type.- Specified by:
canConvertin interfaceConversion- Type Parameters:
SOURCE_TYPE- The source generic typeTARGET_TYPE- The target generic type- Parameters:
sourceTypeClass- The source type classtargetTypeClass- The target type class- Returns:
trueif conversion is possible, otherwise,false
-
canConvert
Description copied from interface:ConversionReturns whether the given object can be converted to the given target type.- Specified by:
canConvertin interfaceConversion- Type Parameters:
TARGET_TYPE- The target generic type- Parameters:
object- The source objecttargetTypeClass- The target type class- Returns:
trueif conversion is possible, otherwise,false
-
convert
public <SOURCE_TYPE,TARGET_TYPE> TARGET_TYPE convert(SOURCE_TYPE object, Class<TARGET_TYPE> targetTypeClass) Description copied from interface:ConversionConverts an object to the target type.- Specified by:
convertin interfaceConversion- Type Parameters:
SOURCE_TYPE- The source generic typeTARGET_TYPE- The target generic type- Parameters:
object- The object to converttargetTypeClass- The target type class- Returns:
- converted object
-
convert
public <SOURCE_TYPE,TARGET_TYPE> TARGET_TYPE convert(SOURCE_TYPE object, Class<SOURCE_TYPE> sourceTypeClass, Class<TARGET_TYPE> targetTypeClass) Description copied from interface:ConversionConverts an object to the target type.- Specified by:
convertin interfaceConversion- Type Parameters:
SOURCE_TYPE- The source generic typeTARGET_TYPE- The target generic type- Parameters:
object- The object to convertsourceTypeClass- The source type classtargetTypeClass- The target type class- Returns:
- converted object
-
convert
public <SOURCE_TYPE,TARGET_TYPE> List<TARGET_TYPE> convert(Iterable<SOURCE_TYPE> objectIterable, Class<TARGET_TYPE> targetTypeClass) Description copied from interface:ConversionConverts each object from an iterable to the target type.- Specified by:
convertin interfaceConversion- Type Parameters:
SOURCE_TYPE- The source generic typeTARGET_TYPE- The target generic type- Parameters:
objectIterable- The iterable of objects to converttargetTypeClass- The target type class- Returns:
- converted collection of objects
-
convert
public <SOURCE_TYPE,TARGET_TYPE> List<TARGET_TYPE> convert(Iterable<SOURCE_TYPE> objectIterable, Class<SOURCE_TYPE> sourceTypeClass, Class<TARGET_TYPE> targetTypeClass) Description copied from interface:ConversionConverts each object from a set to the target type.- Specified by:
convertin interfaceConversion- Type Parameters:
SOURCE_TYPE- The source generic typeTARGET_TYPE- The target generic type- Parameters:
objectIterable- The iterable of objects to convertsourceTypeClass- The source type classtargetTypeClass- The target type class- Returns:
- converted collection of objects
-
convert
public <SOURCE_TYPE,TARGET_TYPE> List<TARGET_TYPE> convert(List<SOURCE_TYPE> objectList, Class<TARGET_TYPE> targetTypeClass) Description copied from interface:ConversionConverts each object from a list to the target type.- Specified by:
convertin interfaceConversion- Type Parameters:
SOURCE_TYPE- The source generic typeTARGET_TYPE- The target generic type- Parameters:
objectList- The list of objects to converttargetTypeClass- The target type class- Returns:
- converted collection of objects
-
convert
public <SOURCE_TYPE,TARGET_TYPE> List<TARGET_TYPE> convert(List<SOURCE_TYPE> objectList, Class<SOURCE_TYPE> sourceTypeClass, Class<TARGET_TYPE> targetTypeClass) Description copied from interface:ConversionConverts each object from a list to the target type.- Specified by:
convertin interfaceConversion- Type Parameters:
SOURCE_TYPE- The source generic typeTARGET_TYPE- The target generic type- Parameters:
objectList- The list of objects to convertsourceTypeClass- The source type classtargetTypeClass- The target type class- Returns:
- converted collection of objects
-
convert
public <SOURCE_TYPE,TARGET_TYPE> Set<TARGET_TYPE> convert(Set<SOURCE_TYPE> objectSet, Class<TARGET_TYPE> targetTypeClass) Description copied from interface:ConversionConverts each object from a set to the target type.- Specified by:
convertin interfaceConversion- Type Parameters:
SOURCE_TYPE- The source generic typeTARGET_TYPE- The target generic type- Parameters:
objectSet- The set of objects to converttargetTypeClass- The target type class- Returns:
- converted collection of objects
-
convert
public <SOURCE_TYPE,TARGET_TYPE> Set<TARGET_TYPE> convert(Set<SOURCE_TYPE> objectSet, Class<SOURCE_TYPE> sourceTypeClass, Class<TARGET_TYPE> targetTypeClass) Description copied from interface:ConversionConverts each object from a set to the target type.- Specified by:
convertin interfaceConversion- Type Parameters:
SOURCE_TYPE- The source generic typeTARGET_TYPE- The target generic type- Parameters:
objectSet- The set of objects to convertsourceTypeClass- The source type classtargetTypeClass- The target type class- Returns:
- converted collection of objects
-