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<S,T> boolean canConvert(Class<S> sourceTypeClass, Class<T> targetTypeClass) Returns whether the given source type can be converted to the given target type.<T> booleancanConvert(Object object, Class<T> targetTypeClass) Returns whether the given object can be converted to the given target type.<S,T> List<T> Converts each object from a set to the target type.<S,T> List<T> Converts each object from an iterable to the target type.<S,T> List<T> Converts each object from a list to the target type.<S,T> List<T> Converts each object from a list to the target type.<S,T> Set<T> Converts each object from a set to the target type.<S,T> Set<T> Converts each object from a set to the target type.<S,T> T Converts an object to the target type.<S,T> T Converts an object to the target type.
-
Constructor Details
-
DefaultConversion
Build a new instance.- Parameters:
converterManager- Instance of the Converter Manager
-
-
Method Details
-
canConvert
Description copied from interface:ConversionReturns whether the given source type can be converted to the given target type.- Specified by:
canConvertin interfaceConversion- Type Parameters:
S- The source generic typeT- 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:
T- The target generic type- Parameters:
object- The source objecttargetTypeClass- The target type class- Returns:
trueif conversion is possible, otherwise,false
-
convert
Description copied from interface:ConversionConverts an object to the target type.- Specified by:
convertin interfaceConversion- Type Parameters:
S- The source generic typeT- The target generic type- Parameters:
object- The object to converttargetTypeClass- The target type class- Returns:
- converted object
-
convert
Description copied from interface:ConversionConverts an object to the target type.- Specified by:
convertin interfaceConversion- Type Parameters:
S- The source generic typeT- The target generic type- Parameters:
object- The object to convertsourceTypeClass- The source type classtargetTypeClass- The target type class- Returns:
- converted object
-
convert
Description copied from interface:ConversionConverts each object from an iterable to the target type.- Specified by:
convertin interfaceConversion- Type Parameters:
S- The source generic typeT- The target generic type- Parameters:
objectIterable- The iterable of objects to converttargetTypeClass- The target type class- Returns:
- converted collection of objects
-
convert
public <S,T> List<T> convert(Iterable<S> objectIterable, Class<S> sourceTypeClass, Class<T> targetTypeClass) Description copied from interface:ConversionConverts each object from a set to the target type.- Specified by:
convertin interfaceConversion- Type Parameters:
S- The source generic typeT- 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
Description copied from interface:ConversionConverts each object from a list to the target type.- Specified by:
convertin interfaceConversion- Type Parameters:
S- The source generic typeT- The target generic type- Parameters:
objectList- The list of objects to converttargetTypeClass- The target type class- Returns:
- converted collection of objects
-
convert
public <S,T> List<T> convert(List<S> objectList, Class<S> sourceTypeClass, Class<T> targetTypeClass) Description copied from interface:ConversionConverts each object from a list to the target type.- Specified by:
convertin interfaceConversion- Type Parameters:
S- The source generic typeT- 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
Description copied from interface:ConversionConverts each object from a set to the target type.- Specified by:
convertin interfaceConversion- Type Parameters:
S- The source generic typeT- The target generic type- Parameters:
objectSet- The set of objects to converttargetTypeClass- The target type class- Returns:
- converted collection of objects
-
convert
Description copied from interface:ConversionConverts each object from a set to the target type.- Specified by:
convertin interfaceConversion- Type Parameters:
S- The source generic typeT- 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
-