Class FeatureProxyFactoryBean

  • All Implemented Interfaces:
    org.springframework.beans.factory.FactoryBean<Object>, org.springframework.beans.factory.InitializingBean

    public class FeatureProxyFactoryBean
    extends Object
    implements org.springframework.beans.factory.FactoryBean<Object>, org.springframework.beans.factory.InitializingBean

    Implementation of FactoryBean that creates a proxy that delegates invocation to one of two target beans depending on that state of a given feature.

    You can use the factory like this:

     <bean id="someService" class="org.togglz.spring.proxy.FeatureProxyFactoryBean">
       <property name="feature" value="FEATURE_ONE" />
       <property name="active" ref="newServiceImpl" />
       <property name="inactive" ref="oldServiceImpl" />
     </bean>
     
    Author:
    Christian Kaltepoth
    • Constructor Detail

      • FeatureProxyFactoryBean

        public FeatureProxyFactoryBean()
    • Method Detail

      • afterPropertiesSet

        public void afterPropertiesSet()
                                throws Exception
        Specified by:
        afterPropertiesSet in interface org.springframework.beans.factory.InitializingBean
        Throws:
        Exception
      • getObject

        public Object getObject()
                         throws Exception
        Specified by:
        getObject in interface org.springframework.beans.factory.FactoryBean<Object>
        Throws:
        Exception
      • getObjectType

        public Class<?> getObjectType()
        Specified by:
        getObjectType in interface org.springframework.beans.factory.FactoryBean<Object>
      • isSingleton

        public boolean isSingleton()
        Specified by:
        isSingleton in interface org.springframework.beans.factory.FactoryBean<Object>
      • getFeature

        public String getFeature()
      • setFeature

        public void setFeature​(String feature)
      • getActive

        public Object getActive()
      • setActive

        public void setActive​(Object active)
      • getInactive

        public Object getInactive()
      • setInactive

        public void setInactive​(Object inactive)
      • getProxyType

        public Class<?> getProxyType()
      • setProxyType

        public void setProxyType​(Class<?> proxyType)