Package net.vleo.timel.conversion
Interface Conversion<S,T>
-
- All Known Implementing Classes:
DoubleToFloatConversion
,DoubleToIntegerConversion
,FloatToDoubleConversion
,FloatToIntegerConversion
,IntegerToFloatConversion
,IntegralDoubleToIntegralFloatConversion
,IntegralDoubleToIntegralIntegerConversion
,IntegralFloatToIntegralDoubleConversion
,IntegralFloatToIntegralIntegerConversion
,IntegralIntegerToIntegralFloatConversion
,ZeroToIntegerConversion
public interface Conversion<S,T>
Abstract type conversion.- Author:
- Andrea Leofreddi
-
-
Method Detail
-
resolveReturnType
default Optional<Type<? extends T>> resolveReturnType(Type<? extends S> source, Type<? extends T> target)
Helps the compiler to resolve the return type for a possible conversion. Note that this method is always called with a concrete source type (either a non-template, or a specialised one) and a target template type which can be either a non-template or an unbounded template.This method is invoked by the compiler due to one of the following conditions:
- The source type is a specialized template, so the compiler needs to ensure that it can be effectively casted
- The target type is a unbounded template, so the compiler needs to resolve a specialisation for it
The default implementation will handle the aforementioned cases as follows:
- When the source is a specialised template and the target is an unbounded template, specialise the target using the same parameters as the source
- No match in any other case
- Parameters:
source
- The source type. It is ensured to be a concrete typetarget
- The target type. Could be either a non-template or an unbounded template- Returns:
- The specialized return type, or empty when no match
-
-