com.github.trang.copiers.cglib.BeanToMapCopier Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of copiers Show documentation
Show all versions of copiers Show documentation
A Friendly Bean Copier Packaging.
package com.github.trang.copiers.cglib;
import static com.github.trang.copiers.util.Preconditions.checkNotNull;
import java.util.HashMap;
import java.util.Map;
import java.util.function.Supplier;
import com.github.trang.copiers.base.Copier;
import com.github.trang.copiers.exception.CopierException;
import lombok.extern.slf4j.Slf4j;
import net.sf.cglib.beans.BeanMap;
/**
* JavaBean 转换为 Map
*
* @author trang
*/
@Slf4j(topic = "copiers")
public class BeanToMapCopier implements Copier> {
@Override
public Map copy(F bean) {
return copy(bean, HashMap::new);
}
@SuppressWarnings("unchecked")
public Map copy(F bean, Supplier