## org.codehaus.groovy.grails.commons.spring
Class DefaultBeanConfiguration

    java.lang.Object
      groovy.lang.GroovyObjectSupport
          org.codehaus.groovy.grails.commons.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
Author:
  Graeme

Field Summary

Fields inherited from interface org.codehaus.groovy.grails.commons.spring.BeanConfiguration
`AUTOWIRE_BY_NAME, AUTOWIRE_BY_TYPE`

Constructor Summary
`DefaultBeanConfiguration(Class clazz2)`
`DefaultBeanConfiguration(Class clazz2, Collection constructorArguments)`
`DefaultBeanConfiguration(String name)`
`DefaultBeanConfiguration(String name2, boolean prototype)`
`DefaultBeanConfiguration(String name, Class clazz)`
`DefaultBeanConfiguration(String name, Class clazz, boolean prototype)`
`DefaultBeanConfiguration(String name2, Class clazz2, Collection args)`

Method Summary
`BeanConfiguration` `addProperty(String propertyName, Object propertyValue)` Adds a property value to this bean
`protected AbstractBeanDefinition` `createBeanDefinition()`
`AbstractBeanDefinition` `getBeanDefinition()`
`String` `getName()`
`Object` `getProperty(String property)`
`Object` `getPropertyValue(String name)` Returns the value of the given property or throws a MissingPropertyException
`boolean` `hasProperty(String name)` Returns true if the bean config has the name property set
`boolean` `isSingleton()`
`BeanConfiguration` `setAbstract(boolean isAbstract)` Sets the BeanConfiguration as an Abstract bean definition
`BeanConfiguration` `setAutowire(String type)` Sets the autowire type, either "byType" or "byName"
`BeanConfiguration` `setDependsOn(String[] dependsOn)` Sets the names of the beans this bean configuration depends on
`BeanConfiguration` `setDestroyMethod(String methodName)` Sets the name of the method to call when destroying the bean
`BeanConfiguration` `setFactoryBean(String beanName)`
`BeanConfiguration` `setFactoryMethod(String methodName)`
`void` `setName(String beanName)` Sets the name of the bean in the app ctx
`void` `setParent(Object obj)` Sets the name of the parent bean
`void` `setProperty(String property, Object newValue)`
`void` `setPropertyValue(String property, Object newValue)` Sets a property value on the bean configuration

Methods inherited from class groovy.lang.GroovyObjectSupport
`getMetaClass, invokeMethod, setMetaClass`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### 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 Detail

### getProperty

    public Object getProperty(String property)

  Specified by:
    `getProperty` in interface `groovy.lang.GroovyObject`
  Overrides:
    `getProperty` in class `groovy.lang.GroovyObjectSupport`

### setProperty

    public void setProperty(String property,
                            Object newValue)

  Specified by:
    `setProperty` in interface `groovy.lang.GroovyObject`
  Overrides:
    `setProperty` in class `groovy.lang.GroovyObjectSupport`

### 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 AbstractBeanDefinition getBeanDefinition()

  Specified by:
    `getBeanDefinition` in interface `BeanConfiguration`
  Returns:
    The Spring bean definition instance

### createBeanDefinition

    protected 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 name)

  Description copied from interface: `BeanConfiguration`
  Returns the value of the given property or throws a MissingPropertyException

  Specified by:
    `getPropertyValue` in interface `BeanConfiguration`
  Parameters:
    `name` - The name of the property
  Returns:
    The value of the property

### hasProperty

    public boolean hasProperty(String name)

  Description copied from interface: `BeanConfiguration`
  Returns true if the bean config has the name property set

  Specified by:
    `hasProperty` in interface `BeanConfiguration`
  Parameters:
    `name` - 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

Copyright (c) 2005-2006 The Grails project