io.beanmapper.spring.unproxy.HibernateAwareBeanUnproxy Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of beanmapper-spring Show documentation
Show all versions of beanmapper-spring Show documentation
Spring support for the Bean Mapper
package io.beanmapper.spring.unproxy;
import io.beanmapper.core.unproxy.BeanUnproxy;
import org.hibernate.proxy.HibernateProxy;
public class HibernateAwareBeanUnproxy implements BeanUnproxy {
/**
* {@inheritDoc}
*/
@Override
public Class> unproxy(Class> beanClass) {
String name = beanClass.getName();
if (name.contains("$")) {
Class> interfaceClass = beanClass.getInterfaces()[0];
if (interfaceClass.equals(HibernateProxy.class)) {
return beanClass.getSuperclass();
} else {
return beanClass.getInterfaces()[0];
}
}
return beanClass;
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy