类 PropertyMapper

java.lang.Object
cn.taketoday.util.PropertyMapper

public final class PropertyMapper extends Object
Utility that can be used to map values from a supplied source to a destination.

Can filter values based on predicates and adapt values if needed. For example:

 PropertyMapper map = PropertyMapper.get();
 map.from(source::getName)
   .to(destination::setName);
 map.from(source::getTimeout)
   .whenNonNull()
   .asInt(Duration::getSeconds)
   .to(destination::setTimeoutSecs);
 map.from(source::isEnabled)
   .whenFalse().
   .toCall(destination::disable);
 

Mappings can ultimately be applied to a setter, trigger a method call or create a new instance.

从以下版本开始:
4.0 2022/1/16 17:01
作者:
Phillip Webb, Artsiom Yudovin, Harry Yang