step.core.collections.PojoUtils Maven / Gradle / Ivy
package step.core.collections;
import java.lang.reflect.InvocationTargetException;
import java.util.Comparator;
import java.util.Map;
import org.apache.commons.beanutils.BeanUtilsBean;
import org.apache.commons.beanutils.ConvertUtilsBean;
import org.apache.commons.beanutils.NestedNullException;
import org.apache.commons.beanutils.PropertyUtilsBean;
import step.core.accessors.AbstractIdentifiableObject;
public class PojoUtils {
private static BeanUtilsBean beanUtilsBean;
public static Object getProperty(Object bean, String propertyName) throws IllegalAccessException, InvocationTargetException, NoSuchMethodException {
try {
return beanUtilsBean.getPropertyUtils().getNestedProperty(bean, propertyName);
} catch (NestedNullException e) {
return null;
}
}
public static Comparator