Class ConverterImpl
- java.lang.Object
-
- com.expediagroup.beans.conversion.ConverterImpl
-
-
Constructor Summary
Constructors Constructor Description ConverterImpl()
Default constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description <T,K>
KconvertValue(T valueToConvert, java.lang.Class<K> targetClass)
Converts a given primitive value into the given primitive type.java.util.Optional<java.util.function.Function<java.lang.Object,java.lang.Object>>
getConversionFunction(java.lang.Class<?> sourceClass, java.lang.Class<?> targetClass)
It provides a conversion function for the given primitive type into the other.
-
-
-
Method Detail
-
getConversionFunction
public java.util.Optional<java.util.function.Function<java.lang.Object,java.lang.Object>> getConversionFunction(java.lang.Class<?> sourceClass, java.lang.Class<?> targetClass)
It provides a conversion function for the given primitive type into the other.- Specified by:
getConversionFunction
in interfaceConverter
- Parameters:
sourceClass
- source field classtargetClass
- the destination field class- Returns:
- an
Optional
containing the conversion function (if exists)
-
convertValue
public <T,K> K convertValue(T valueToConvert, java.lang.Class<K> targetClass)
Converts a given primitive value into the given primitive type.- Specified by:
convertValue
in interfaceConverter
- Type Parameters:
T
- the value to convert typeK
- the target object type- Parameters:
valueToConvert
- the value to be convertedtargetClass
- the destination field class- Returns:
- the converted value
-
-