org.onetwo.common.reflect.BeanToMapConvertor Maven / Gradle / Ivy
package org.onetwo.common.reflect;
import java.beans.PropertyDescriptor;
import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import java.util.Set;
import java.util.function.BiFunction;
import java.util.function.Function;
import org.onetwo.common.utils.CUtils;
import org.onetwo.common.utils.LangUtils;
import org.onetwo.common.utils.StringUtils;
public class BeanToMapConvertor {
static public class DefaultPropertyAcceptor implements BiFunction {
@Override
public Boolean apply(PropertyDescriptor prop, Object val) {
String clsName = prop.getPropertyType().getName();
if(clsName.startsWith("groovy.lang.MetaClass") ){
return false;
}
return val!=null;
}
}
private String listOpener = "[";
private String listCloser = "]";
private String propertyAccesor = ".";
private String prefix = "";
private BiFunction propertyAcceptor = new DefaultPropertyAcceptor();
private Function
© 2015 - 2024 Weber Informatics LLC | Privacy Policy