com.gitee.feizns.bean.Convertible Maven / Gradle / Ivy
package com.gitee.feizns.bean;
import com.gitee.feizns.StreamUtils;
import java.util.function.Function;
/**
* @author feizns
* @since 2019/6/9 0009
*/
public interface Convertible extends PropertiesIterable {
/**
* 复制属性,并新建一个
* @param targetType
* @return
*/
default T to(Class targetType) {
return to(targetType, StreamUtils::noChangeFun);
}
/**
* 复制属性,并新建一个
* @param targetType
* @return
*/
default T to(Class targetType, Function popsMap) {
return BeanUtils.copyProperties(targetType, popsMap, this);
}
/**
* ...
* @param target
* @param
* @return
*/
default T to(T target) {
return to(target, StreamUtils::noChangeFun);
}
/**
* 复制属性,并新建一个
* @param target
* @return
*/
default T to(T target, Function popsMap) {
return BeanUtils.copyProperties(target, popsMap, this);
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy