Class ConversionHelper


  • public final class ConversionHelper
    extends java.lang.Object
    Helper class for copying properties between objects.
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static <SRC,​DEST,​COLL extends java.util.Collection<DEST>>
      COLL
      convertAll​(java.util.Collection<SRC> src, Converter<SRC,​DEST> converter, COLL target)
      Converts with the given Converter elements of the given collection src into the collection target.
      static void copyProperties​(java.lang.Object source, java.lang.Object target)
      Copies the property from the source object (bean) to the target object (bean).
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Method Detail

      • copyProperties

        public static void copyProperties​(java.lang.Object source,
                                          java.lang.Object target)
                                   throws ConversionException
        Copies the property from the source object (bean) to the target object (bean).
        Throws:
        ConversionException
      • convertAll

        public static <SRC,​DEST,​COLL extends java.util.Collection<DEST>> COLL convertAll​(java.util.Collection<SRC> src,
                                                                                                     Converter<SRC,​DEST> converter,
                                                                                                     COLL target)
        Converts with the given Converter elements of the given collection src into the collection target.
        Parameters:
        src - a collection with the source elements which will be converted
        converter - the converter which transforms a single element from the source type into an element of the target type
        target - this collection contains the transformed elements from the source collection
        Returns:
        the parameter target with the converted elements.