Example usage for org.springframework.cglib.proxy Enhancer isEnhanced

List of usage examples for org.springframework.cglib.proxy Enhancer isEnhanced

Introduction

In this page you can find the example usage for org.springframework.cglib.proxy Enhancer isEnhanced.

Prototype

public static boolean isEnhanced(Class type) 

Source Link

Document

Determine if a class was generated using Enhancer.

Usage

From source file:cf.spring.servicebroker.AbstractAnnotationCatalogAccessorProvider.java

/**
 * Returns the class of the specified bean name.
 *///ww w  .  j ava2 s .c  om
protected Class<?> getBeanClass(String beanName) {
    Class<?> clazz = context.getType(beanName);
    while (Proxy.isProxyClass(clazz) || Enhancer.isEnhanced(clazz)) {
        clazz = clazz.getSuperclass();
    }
    return clazz;
}

From source file:org.springframework.boot.autoconfigure.ComponentScanDetector.java

private AnnotationMetadata getMetadata(BeanDefinition beanDefinition) {
    if (beanDefinition instanceof AbstractBeanDefinition
            && ((AbstractBeanDefinition) beanDefinition).hasBeanClass()) {
        Class<?> beanClass = ((AbstractBeanDefinition) beanDefinition).getBeanClass();
        if (Enhancer.isEnhanced(beanClass)) {
            beanClass = beanClass.getSuperclass();
        }/*from   ww w  . j  a v  a  2s  . c  o m*/
        return new StandardAnnotationMetadata(beanClass, true);
    }
    String className = beanDefinition.getBeanClassName();
    if (className != null) {
        try {
            MetadataReader metadataReader = this.metadataReaderFactory.getMetadataReader(className);
            return metadataReader.getAnnotationMetadata();
        } catch (IOException ex) {
            if (this.logger.isDebugEnabled()) {
                this.logger.debug(
                        "Could not find class file for introspecting @ComponentScan classes: " + className, ex);
            }
        }
    }
    return null;
}