All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.gitee.feizns.bean.Convertible Maven / Gradle / Ivy

There is a newer version: 5.5-RELEASE
Show newest version
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