Package jodd.bean

Class BeanCopy


  • public class BeanCopy
    extends java.lang.Object
    Powerful tool for copying properties from one bean into another. BeanCopy works with POJO beans, but also with Map.
    See Also:
    BeanVisitor
    • Constructor Summary

      Constructors 
      Constructor Description
      BeanCopy​(java.lang.Object source, java.lang.Object destination)
      Creates new BeanCopy process between the source and the destination.
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void copy()
      Performs the copying.
      BeanCopy declared​(boolean declared)
      Defines if all properties should be copied (when set to true) or only public (when set to false, default).
      BeanCopy filter​(java.util.function.BiPredicate<java.lang.String,​java.lang.Object> filter)  
      BeanCopy filter​(java.util.function.Predicate<java.lang.String> filter)  
      BeanCopy forced​(boolean forced)  
      static BeanCopy from​(java.lang.Object source)
      Creates BeanCopy with given POJO bean as a source.
      BeanCopy includeFields​(boolean includeFields)  
      BeanCopy to​(java.lang.Object destination)
      Defines destination, detects a map.
      • Methods inherited from class java.lang.Object

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

      • BeanCopy

        public BeanCopy​(java.lang.Object source,
                        java.lang.Object destination)
        Creates new BeanCopy process between the source and the destination. Both source and destination can be a POJO object or a Map.
    • Method Detail

      • from

        public static BeanCopy from​(java.lang.Object source)
        Creates BeanCopy with given POJO bean as a source.
      • to

        public BeanCopy to​(java.lang.Object destination)
        Defines destination, detects a map.
      • declared

        public BeanCopy declared​(boolean declared)
        Defines if all properties should be copied (when set to true) or only public (when set to false, default).
      • forced

        public BeanCopy forced​(boolean forced)
      • filter

        public BeanCopy filter​(java.util.function.Predicate<java.lang.String> filter)
      • filter

        public BeanCopy filter​(java.util.function.BiPredicate<java.lang.String,​java.lang.Object> filter)
      • includeFields

        public BeanCopy includeFields​(boolean includeFields)
      • copy

        public void copy()
        Performs the copying.