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

com.fengwenyi.javalib.bean.BeanUtils Maven / Gradle / Ivy

There is a newer version: 3.0.1
Show newest version
package com.fengwenyi.javalib.bean;

import com.fengwenyi.javalib.convert.JsonUtils;

/**
 * Bean工具类
 * @author Erwin Feng
 * @since 2020/8/18
 */
public class BeanUtils {

    /**
     * 将源对象的属性值拷贝给目标对象。
     * 

* 先将源对象转换成json字符, * 再将json字符串转换成目标对象。 *

* @param source 源对象 * @param targetClazz 目标对象的class * @param 目标对象 * @return 返回目标对象 */ public static T copy(Object source, Class targetClazz) { String jsonString = JsonUtils.convertString(source); return JsonUtils.convertObject(jsonString, targetClazz); } }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy