jodd.petite
Class ScopedProxyManager

java.lang.Object
  extended by jodd.petite.ScopedProxyManager

public class ScopedProxyManager
extends Object

Manager for mixing scopes. 'Mixed scopes' is the situation when 'smaller' scope is injected into the 'bigger' scope. Trivial example is when prototype scoped bean is injected into singleton bean.

Mixed scopes are handled using smart factory/proxy-wrapper singletons instead of 'smaller' scoped beans. On each method call of wrapped factory, smaller scoped bean will be looked up and that instance will be used for passing by the method call.

Manager also has to determine if scope combination is candidate for mixed scopes.


Field Summary
protected  ProxyAspect aspect
           
protected  Map<String,Object> proxies
           
protected  Map<Class,Class> proxyClasses
           
 
Constructor Summary
ScopedProxyManager()
           
 
Method Summary
protected  String createMixingMessage(BeanDefinition targetBeanDefinition, BeanDefinition refBeanDefinition)
          Creates mixed scope message.
protected  Object createScopedProxyBean(PetiteContainer petiteContainer, BeanDefinition refBeanDefinition)
          Creates scoped proxy bean for given bean definition.
 Object lookupValue(PetiteContainer petiteContainer, BeanDefinition targetBeanDefinition, BeanDefinition refBeanDefinition)
          Returns scoped proxy bean if injection scopes are mixed on some injection point.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

aspect

protected ProxyAspect aspect

proxyClasses

protected Map<Class,Class> proxyClasses

proxies

protected Map<String,Object> proxies
Constructor Detail

ScopedProxyManager

public ScopedProxyManager()
Method Detail

lookupValue

public Object lookupValue(PetiteContainer petiteContainer,
                          BeanDefinition targetBeanDefinition,
                          BeanDefinition refBeanDefinition)
Returns scoped proxy bean if injection scopes are mixed on some injection point. May return null if mixing scopes is not detected.


createMixingMessage

protected String createMixingMessage(BeanDefinition targetBeanDefinition,
                                     BeanDefinition refBeanDefinition)
Creates mixed scope message.


createScopedProxyBean

protected Object createScopedProxyBean(PetiteContainer petiteContainer,
                                       BeanDefinition refBeanDefinition)
Creates scoped proxy bean for given bean definition.