Example usage for org.springframework.context.annotation ScopedProxyMode equals

List of usage examples for org.springframework.context.annotation ScopedProxyMode equals

Introduction

In this page you can find the example usage for org.springframework.context.annotation ScopedProxyMode equals.

Prototype

public boolean equals(Object obj) 

Source Link

Document

Indicates whether some other object is "equal to" this one.

Usage

From source file:br.com.caelum.vraptor.ioc.spring.SpringRegistry.java

/**
 * From org.springframework.context.annotation.ClassPathBeanDefinitionScanner#applyScope()
 * @param definition//  ww  w.  j  a  v  a  2s . c  om
 * @param scopeMetadata
 *
 * @return
 */
private BeanDefinitionHolder applyScopeOn(BeanDefinitionHolder definition, ScopeMetadata scopeMetadata) {
    String scope = scopeMetadata.getScopeName();
    ScopedProxyMode proxyMode = scopeMetadata.getScopedProxyMode();
    definition.getBeanDefinition().setScope(scope);
    if (BeanDefinition.SCOPE_SINGLETON.equals(scope) || BeanDefinition.SCOPE_PROTOTYPE.equals(scope)
            || proxyMode.equals(ScopedProxyMode.NO)) {
        return definition;
    } else {
        boolean proxyTargetClass = proxyMode.equals(ScopedProxyMode.TARGET_CLASS);
        return ScopedProxyUtils.createScopedProxy(definition, (BeanDefinitionRegistry) beanFactory,
                proxyTargetClass);
    }
}

From source file:org.rosenvold.spring.convention.ConventionBeanFactory.java

private void registerBeanByResolvedType(String beanName, Class<?> resolvedType) {
    if (resolvedType == null)
        return;//from ww w.ja v a2 s  .  c o  m
    final BeanDefinition beanDefinition = getOrCreateBeanDefinition(beanName, resolvedType);
    BeanDefinitionHolder definitionHolder = new BeanDefinitionHolder(beanDefinition, beanName);
    ScopeMetadata scopeMetadata = this.scopeMetadataResolver.resolveScopeMetadata(beanDefinition);

    ScopedProxyMode scopedProxyMode = scopeMetadata.getScopedProxyMode();
    if (!scopedProxyMode.equals(ScopedProxyMode.NO)) {
        definitionHolder = ScopedProxyUtils.createScopedProxy(definitionHolder, this,
                scopedProxyMode.equals(ScopedProxyMode.TARGET_CLASS));
    }
    registerBeanDefinition(beanName, definitionHolder.getBeanDefinition());
}