Class DefaultBeanConfiguration

java.lang.Object
groovy.lang.GroovyObjectSupport
org.grails.spring.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 Details

    • DefaultBeanConfiguration

      public DefaultBeanConfiguration(String name, Class<?> clazz)
    • DefaultBeanConfiguration

      public DefaultBeanConfiguration(String name, Class<?> clazz, boolean prototype)
    • DefaultBeanConfiguration

      public DefaultBeanConfiguration(String name)
    • DefaultBeanConfiguration

      public DefaultBeanConfiguration(Class<?> clazz2)
    • DefaultBeanConfiguration

      public DefaultBeanConfiguration(String name2, Class<?> clazz2, Collection<?> args)
    • DefaultBeanConfiguration

      public DefaultBeanConfiguration(String name2, boolean prototype)
    • DefaultBeanConfiguration

      public DefaultBeanConfiguration(Class<?> clazz2, Collection<?> constructorArguments)
  • Method Details

    • getProperty

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

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

      public 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(String propertyName, 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(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(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
    • setFactoryBean

      public BeanConfiguration setFactoryBean(String beanName)
      Specified by:
      setFactoryBean in interface BeanConfiguration
      Returns:
      This BeanConfiguration
    • setFactoryMethod

      public BeanConfiguration setFactoryMethod(String methodName)
      Specified by:
      setFactoryMethod in interface BeanConfiguration
      Returns:
      This BeanConfiguration
    • setAutowire

      public BeanConfiguration setAutowire(String type)
      Description copied from interface: BeanConfiguration
      Sets the autowire type, either "byType" or "byName"
      Specified by:
      setAutowire in interface BeanConfiguration
      Parameters:
      type - The type
      Returns:
      This BeanConfiguration
    • setName

      public void setName(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 Object getPropertyValue(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(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(String property, 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(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