Class ConcatenationConverter<SourceType,IntermediateType,TargetType>
- java.lang.Object
-
- com.saperion.common.lang.conversion.ConcatenationConverter<SourceType,IntermediateType,TargetType>
-
- All Implemented Interfaces:
Converter<SourceType,TargetType>
public class ConcatenationConverter<SourceType,IntermediateType,TargetType> extends java.lang.Object implements Converter<SourceType,TargetType>
Concatenates twoConvertersto obtain anotherConverter. For a given Converter<T1, T2> A and a given Converter<T2, T3> A the ConcatenationConverter(A, B) will convert given instances of T1 to T3 by first converting to T2 with A and then to T3 with B.- Author:
- jschwarz
-
-
Constructor Summary
Constructors Constructor Description ConcatenationConverter(Converter<SourceType,IntermediateType> firstConverter, Converter<IntermediateType,TargetType> secondConverter)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static <T1,T2,T3>
Converter<T1,T3>concatenate(Converter<T1,T2> first, Converter<T2,T3> second)Convenience factory method omitting the explicit generic parameters.static <T1,T2,T3,T4>
Converter<T1,T4>concatenate(Converter<T1,T2> first, Converter<T2,T3> second, Converter<T3,T4> third)Convenience factory method omitting the explicit generic parameters.static <T1,T2,T3,T4,T5>
Converter<T1,T5>concatenate(Converter<T1,T2> first, Converter<T2,T3> second, Converter<T3,T4> third, Converter<T4,T5> fourth)Convenience factory method omitting the explicit generic parameters.TargetTypeconvert(SourceType sourceType)Converts the specified object and returns the conversion result.
-
-
-
Constructor Detail
-
ConcatenationConverter
public ConcatenationConverter(Converter<SourceType,IntermediateType> firstConverter, Converter<IntermediateType,TargetType> secondConverter)
-
-
Method Detail
-
convert
public TargetType convert(SourceType sourceType)
Description copied from interface:ConverterConverts the specified object and returns the conversion result. Implementations have to acceptnull-values without throwing exceptions.- Specified by:
convertin interfaceConverter<SourceType,IntermediateType>- Parameters:
sourceType- object to convert- Returns:
- the converted object
-
concatenate
public static <T1,T2,T3> Converter<T1,T3> concatenate(Converter<T1,T2> first, Converter<T2,T3> second)
Convenience factory method omitting the explicit generic parameters.- Type Parameters:
T1- the input typeT2- the type the first converter converts to and the second converts fromT3- the output type- Parameters:
first- The first converter to concatenatesecond- The second converter to concatenate- Returns:
- A ConcatenationConverter for the given converters.
-
concatenate
public static <T1,T2,T3,T4> Converter<T1,T4> concatenate(Converter<T1,T2> first, Converter<T2,T3> second, Converter<T3,T4> third)
Convenience factory method omitting the explicit generic parameters.- Type Parameters:
T1- the input typeT2- an intermediate typeT3- an intermediate typeT4- the output type- Parameters:
first- The first converter to concatenatesecond- The second converter to concatenatethird- The third converter to concatenate- Returns:
- A ConcatenationConverter for the given converters.
-
concatenate
public static <T1,T2,T3,T4,T5> Converter<T1,T5> concatenate(Converter<T1,T2> first, Converter<T2,T3> second, Converter<T3,T4> third, Converter<T4,T5> fourth)
Convenience factory method omitting the explicit generic parameters.- Type Parameters:
T1- the input typeT2- an intermediate typeT3- an intermediate typeT4- an intermediate typeT5- the output type- Parameters:
first- The first converter to concatenatesecond- The second converter to concatenatethird- The third converter to concatenatefourth- The fourth converter to concatenate- Returns:
- A ConcatenationConverter for the given converters.
-
-