Class DefaultBeanConfiguration

  • All Implemented Interfaces:
    groovy.lang.GroovyObject, BeanConfiguration

    public class DefaultBeanConfiguration
    extends groovy.lang.GroovyObjectSupport
    implements BeanConfiguration
    Default implementation of the BeanConfiguration interface . Credit must go to Solomon Duskis and the article: http://jroller.com/page/Solomon?entry=programmatic_configuration_in_spring
    Since:
    0.3
    • Constructor Detail

      • DefaultBeanConfiguration

        public DefaultBeanConfiguration​(java.lang.String name,
                                        java.lang.Class<?> clazz)
      • DefaultBeanConfiguration

        public DefaultBeanConfiguration​(java.lang.String name,
                                        java.lang.Class<?> clazz,
                                        boolean prototype)
      • DefaultBeanConfiguration

        public DefaultBeanConfiguration​(java.lang.String name)
      • DefaultBeanConfiguration

        public DefaultBeanConfiguration​(java.lang.Class<?> clazz2)
      • DefaultBeanConfiguration

        public DefaultBeanConfiguration​(java.lang.String name2,
                                        java.lang.Class<?> clazz2,
                                        java.util.Collection<?> args)
      • DefaultBeanConfiguration

        public DefaultBeanConfiguration​(java.lang.String name2,
                                        boolean prototype)
      • DefaultBeanConfiguration

        public DefaultBeanConfiguration​(java.lang.Class<?> clazz2,
                                        java.util.Collection<?> constructorArguments)
    • Method Detail

      • getProperty

        public java.lang.Object getProperty​(java.lang.String property)
        Specified by:
        getProperty in interface groovy.lang.GroovyObject
      • setProperty

        public void setProperty​(java.lang.String property,
                                java.lang.Object newValue)
        Specified by:
        setProperty in interface groovy.lang.GroovyObject
      • getName

        public java.lang.String getName()
        Specified by:
        getName in interface BeanConfiguration
        Returns:
        The name of the bean
      • isSingleton

        public boolean isSingleton()
        Specified by:
        isSingleton in interface BeanConfiguration
        Returns:
        true if the bean is singleton
      • getBeanDefinition

        public org.springframework.beans.factory.support.AbstractBeanDefinition getBeanDefinition()
        Specified by:
        getBeanDefinition in interface BeanConfiguration
        Returns:
        The Spring bean definition instance
      • setBeanDefinition

        public void setBeanDefinition​(org.springframework.beans.factory.config.BeanDefinition definition)
        Specified by:
        setBeanDefinition in interface BeanConfiguration
      • createBeanDefinition

        protected org.springframework.beans.factory.support.AbstractBeanDefinition createBeanDefinition()
      • addProperty

        public BeanConfiguration addProperty​(java.lang.String propertyName,
                                             java.lang.Object propertyValue)
        Description copied from interface: BeanConfiguration
        Adds a property value to this bean.
        Specified by:
        addProperty in interface BeanConfiguration
        Parameters:
        propertyName - The name of the property
        propertyValue - The value of the property
        Returns:
        Returns this bean configuration
      • setDestroyMethod

        public BeanConfiguration setDestroyMethod​(java.lang.String methodName)
        Description copied from interface: BeanConfiguration
        Sets the name of the method to call when destroying the bean.
        Specified by:
        setDestroyMethod in interface BeanConfiguration
        Parameters:
        methodName - The method name
        Returns:
        This bean configuration
      • setDependsOn

        public BeanConfiguration setDependsOn​(java.lang.String[] dependsOn)
        Description copied from interface: BeanConfiguration
        Sets the names of the beans this bean configuration depends on
        Specified by:
        setDependsOn in interface BeanConfiguration
        Parameters:
        dependsOn - Bean names it depends on
        Returns:
        This bean configuration
      • setName

        public void setName​(java.lang.String beanName)
        Description copied from interface: BeanConfiguration
        Sets the name of the bean in the app ctx.
        Specified by:
        setName in interface BeanConfiguration
        Parameters:
        beanName - The bean name
      • getPropertyValue

        public java.lang.Object getPropertyValue​(java.lang.String propName)
        Description copied from interface: BeanConfiguration
        Returns the value of the given property or throws a MissingPropertyException.
        Specified by:
        getPropertyValue in interface BeanConfiguration
        Parameters:
        propName - The name of the property
        Returns:
        The value of the property
      • hasProperty

        public boolean hasProperty​(java.lang.String propName)
        Description copied from interface: BeanConfiguration
        Returns true if the bean config has the name property set.
        Specified by:
        hasProperty in interface BeanConfiguration
        Parameters:
        propName - The name of the property
        Returns:
        true if it does have a property with the given name
      • setPropertyValue

        public void setPropertyValue​(java.lang.String property,
                                     java.lang.Object newValue)
        Description copied from interface: BeanConfiguration
        Sets a property value on the bean configuration
        Specified by:
        setPropertyValue in interface BeanConfiguration
        Parameters:
        property - The name of the property
        newValue - The value
      • setAbstract

        public BeanConfiguration setAbstract​(boolean isAbstract)
        Description copied from interface: BeanConfiguration
        Sets the BeanConfiguration as an Abstract bean definition
        Specified by:
        setAbstract in interface BeanConfiguration
        Parameters:
        isAbstract - Whether its abstract or not
        Returns:
        This BeanConfiguration object
      • setParent

        public void setParent​(java.lang.Object obj)
        Description copied from interface: BeanConfiguration
        Sets the name of the parent bean.
        Specified by:
        setParent in interface BeanConfiguration
        Parameters:
        obj - Either a string which is the name of the bean, a RuntimeBeanReference or a BeanConfiguration