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 Object implements Converter<SourceType,TargetType>
Concatenates two Converters to obtain another Converter. 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 Details

  • Method Details

    • convert

      public TargetType convert(SourceType sourceType)
      Description copied from interface: Converter
      Converts the specified object and returns the conversion result.

      Implementations have to accept null-values without throwing exceptions.

      Specified by:
      convert in interface Converter<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 type
      T2 - the type the first converter converts to and the second converts from
      T3 - the output type
      Parameters:
      first - The first converter to concatenate
      second - 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 type
      T2 - an intermediate type
      T3 - an intermediate type
      T4 - the output type
      Parameters:
      first - The first converter to concatenate
      second - The second converter to concatenate
      third - 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 type
      T2 - an intermediate type
      T3 - an intermediate type
      T4 - an intermediate type
      T5 - the output type
      Parameters:
      first - The first converter to concatenate
      second - The second converter to concatenate
      third - The third converter to concatenate
      fourth - The fourth converter to concatenate
      Returns:
      A ConcatenationConverter for the given converters.