org.codehaus.groovy.grails.commons.spring
Interface BeanConfiguration

All Known Implementing Classes:
DefaultBeanConfiguration

public interface BeanConfiguration

An interface that represent a runtime bean configuration 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
static String AUTOWIRE_BY_NAME
           
static String AUTOWIRE_BY_TYPE
           
 
Method Summary
 BeanConfiguration addProperty(String propertyName, Object propertyValue)
          Adds a property value to this bean
 AbstractBeanDefinition getBeanDefinition()
           
 String getName()
           
 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 name)
          Sets the name of the parent bean
 void setPropertyValue(String property, Object newValue)
          Sets a property value on the bean configuration
 

Field Detail

AUTOWIRE_BY_TYPE

static final String AUTOWIRE_BY_TYPE
See Also:
Constant Field Values

AUTOWIRE_BY_NAME

static final String AUTOWIRE_BY_NAME
See Also:
Constant Field Values
Method Detail

getName

String getName()
Returns:
The name of the bean

isSingleton

boolean isSingleton()
Returns:
True if the bean is singleton

getBeanDefinition

AbstractBeanDefinition getBeanDefinition()
Returns:
The Spring bean definition instance

addProperty

BeanConfiguration addProperty(String propertyName,
                              Object propertyValue)
Adds a property value to this bean

Parameters:
propertyName - The name of the property
propertyValue - The value of the property
Returns:
Returns this bean configuration

setDestroyMethod

BeanConfiguration setDestroyMethod(String methodName)
Sets the name of the method to call when destroying the bean

Parameters:
methodName - The method name
Returns:
This bean configuration

setDependsOn

BeanConfiguration setDependsOn(String[] dependsOn)
Sets the names of the beans this bean configuration depends on

Parameters:
dependsOn - Bean names it depends on
Returns:
This bean configuration

setFactoryBean

BeanConfiguration setFactoryBean(String beanName)
Parameters:
beanName -
Returns:
This BeanConfiguration

setFactoryMethod

BeanConfiguration setFactoryMethod(String methodName)
Parameters:
methodName -
Returns:
This BeanConfiguration

setAutowire

BeanConfiguration setAutowire(String type)
Sets the autowire type, either "byType" or "byName"

Parameters:
type - The type
Returns:
This BeanConfiguration

setName

void setName(String beanName)
Sets the name of the bean in the app ctx

Parameters:
beanName - The bean name

hasProperty

boolean hasProperty(String name)
Returns true if the bean config has the name property set

Parameters:
name - The name of the property
Returns:
True if it does have a property with the given name

getPropertyValue

Object getPropertyValue(String name)
Returns the value of the given property or throws a MissingPropertyException

Parameters:
name - The name of the property
Returns:
The value of the property

setPropertyValue

void setPropertyValue(String property,
                      Object newValue)
Sets a property value on the bean configuration

Parameters:
property - The name of the property
newValue - The value

setAbstract

BeanConfiguration setAbstract(boolean isAbstract)
Sets the BeanConfiguration as an Abstract bean definition

Parameters:
isAbstract - Whether its abstract or not
Returns:
This BeanConfiguration object

setParent

void setParent(Object name)
Sets the name of the parent bean

Parameters:
name - Either a string which is the name of the bean, a RuntimeBeanReference or a BeanConfiguration


Copyright (c) 2005-2006 The Grails project