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

io.beanmapper.spring.unproxy.HibernateAwareBeanUnproxy Maven / Gradle / Ivy

There is a newer version: 6.0.0
Show newest version
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