Package org.grails.spring
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
-
-
Field Summary
-
Fields inherited from interface org.grails.spring.BeanConfiguration
AUTOWIRE_BY_NAME, AUTOWIRE_BY_TYPE
-
-
Constructor Summary
Constructors Constructor Description DefaultBeanConfiguration(java.lang.Class<?> clazz2)DefaultBeanConfiguration(java.lang.Class<?> clazz2, java.util.Collection<?> constructorArguments)DefaultBeanConfiguration(java.lang.String name)DefaultBeanConfiguration(java.lang.String name2, boolean prototype)DefaultBeanConfiguration(java.lang.String name, java.lang.Class<?> clazz)DefaultBeanConfiguration(java.lang.String name, java.lang.Class<?> clazz, boolean prototype)DefaultBeanConfiguration(java.lang.String name2, java.lang.Class<?> clazz2, java.util.Collection<?> args)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description BeanConfigurationaddProperty(java.lang.String propertyName, java.lang.Object propertyValue)Adds a property value to this bean.protected org.springframework.beans.factory.support.AbstractBeanDefinitioncreateBeanDefinition()org.springframework.beans.factory.support.AbstractBeanDefinitiongetBeanDefinition()java.lang.StringgetName()java.lang.ObjectgetProperty(java.lang.String property)java.lang.ObjectgetPropertyValue(java.lang.String propName)Returns the value of the given property or throws a MissingPropertyException.booleanhasProperty(java.lang.String propName)Returns true if the bean config has the name property set.booleanisSingleton()BeanConfigurationsetAbstract(boolean isAbstract)Sets the BeanConfiguration as an Abstract bean definitionBeanConfigurationsetAutowire(java.lang.String type)Sets the autowire type, either "byType" or "byName"voidsetBeanDefinition(org.springframework.beans.factory.config.BeanDefinition definition)BeanConfigurationsetDependsOn(java.lang.String[] dependsOn)Sets the names of the beans this bean configuration depends onBeanConfigurationsetDestroyMethod(java.lang.String methodName)Sets the name of the method to call when destroying the bean.BeanConfigurationsetFactoryBean(java.lang.String beanName)BeanConfigurationsetFactoryMethod(java.lang.String methodName)voidsetName(java.lang.String beanName)Sets the name of the bean in the app ctx.voidsetParent(java.lang.Object obj)Sets the name of the parent bean.voidsetProperty(java.lang.String property, java.lang.Object newValue)voidsetPropertyValue(java.lang.String property, java.lang.Object newValue)Sets a property value on the bean configuration
-
-
-
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:
getPropertyin interfacegroovy.lang.GroovyObject
-
setProperty
public void setProperty(java.lang.String property, java.lang.Object newValue)- Specified by:
setPropertyin interfacegroovy.lang.GroovyObject
-
getName
public java.lang.String getName()
- Specified by:
getNamein interfaceBeanConfiguration- Returns:
- The name of the bean
-
isSingleton
public boolean isSingleton()
- Specified by:
isSingletonin interfaceBeanConfiguration- Returns:
- true if the bean is singleton
-
getBeanDefinition
public org.springframework.beans.factory.support.AbstractBeanDefinition getBeanDefinition()
- Specified by:
getBeanDefinitionin interfaceBeanConfiguration- Returns:
- The Spring bean definition instance
-
setBeanDefinition
public void setBeanDefinition(org.springframework.beans.factory.config.BeanDefinition definition)
- Specified by:
setBeanDefinitionin interfaceBeanConfiguration
-
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:BeanConfigurationAdds a property value to this bean.- Specified by:
addPropertyin interfaceBeanConfiguration- Parameters:
propertyName- The name of the propertypropertyValue- The value of the property- Returns:
- Returns this bean configuration
-
setDestroyMethod
public BeanConfiguration setDestroyMethod(java.lang.String methodName)
Description copied from interface:BeanConfigurationSets the name of the method to call when destroying the bean.- Specified by:
setDestroyMethodin interfaceBeanConfiguration- Parameters:
methodName- The method name- Returns:
- This bean configuration
-
setDependsOn
public BeanConfiguration setDependsOn(java.lang.String[] dependsOn)
Description copied from interface:BeanConfigurationSets the names of the beans this bean configuration depends on- Specified by:
setDependsOnin interfaceBeanConfiguration- Parameters:
dependsOn- Bean names it depends on- Returns:
- This bean configuration
-
setFactoryBean
public BeanConfiguration setFactoryBean(java.lang.String beanName)
- Specified by:
setFactoryBeanin interfaceBeanConfiguration- Returns:
- This BeanConfiguration
-
setFactoryMethod
public BeanConfiguration setFactoryMethod(java.lang.String methodName)
- Specified by:
setFactoryMethodin interfaceBeanConfiguration- Returns:
- This BeanConfiguration
-
setAutowire
public BeanConfiguration setAutowire(java.lang.String type)
Description copied from interface:BeanConfigurationSets the autowire type, either "byType" or "byName"- Specified by:
setAutowirein interfaceBeanConfiguration- Parameters:
type- The type- Returns:
- This BeanConfiguration
-
setName
public void setName(java.lang.String beanName)
Description copied from interface:BeanConfigurationSets the name of the bean in the app ctx.- Specified by:
setNamein interfaceBeanConfiguration- Parameters:
beanName- The bean name
-
getPropertyValue
public java.lang.Object getPropertyValue(java.lang.String propName)
Description copied from interface:BeanConfigurationReturns the value of the given property or throws a MissingPropertyException.- Specified by:
getPropertyValuein interfaceBeanConfiguration- 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:BeanConfigurationReturns true if the bean config has the name property set.- Specified by:
hasPropertyin interfaceBeanConfiguration- 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:BeanConfigurationSets a property value on the bean configuration- Specified by:
setPropertyValuein interfaceBeanConfiguration- Parameters:
property- The name of the propertynewValue- The value
-
setAbstract
public BeanConfiguration setAbstract(boolean isAbstract)
Description copied from interface:BeanConfigurationSets the BeanConfiguration as an Abstract bean definition- Specified by:
setAbstractin interfaceBeanConfiguration- Parameters:
isAbstract- Whether its abstract or not- Returns:
- This BeanConfiguration object
-
setParent
public void setParent(java.lang.Object obj)
Description copied from interface:BeanConfigurationSets the name of the parent bean.- Specified by:
setParentin interfaceBeanConfiguration- Parameters:
obj- Either a string which is the name of the bean, a RuntimeBeanReference or a BeanConfiguration
-
-