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
ConstructorsConstructorDescriptionDefaultBeanConfiguration(Class<?> clazz2) DefaultBeanConfiguration(Class<?> clazz2, Collection<?> constructorArguments) 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
Modifier and TypeMethodDescriptionaddProperty(String propertyName, Object propertyValue) Adds a property value to this bean.protected org.springframework.beans.factory.support.AbstractBeanDefinitionorg.springframework.beans.factory.support.AbstractBeanDefinitiongetName()getProperty(String property) getPropertyValue(String propName) Returns the value of the given property or throws a MissingPropertyException.booleanhasProperty(String propName) Returns true if the bean config has the name property set.booleansetAbstract(boolean isAbstract) Sets the BeanConfiguration as an Abstract bean definitionsetAutowire(String type) Sets the autowire type, either "byType" or "byName"voidsetBeanDefinition(org.springframework.beans.factory.config.BeanDefinition definition) setDependsOn(String[] dependsOn) Sets the names of the beans this bean configuration depends onsetDestroyMethod(String methodName) Sets the name of the method to call when destroying the bean.setFactoryBean(String beanName) setFactoryMethod(String methodName) voidSets the name of the bean in the app ctx.voidSets the name of the parent bean.voidsetProperty(String property, Object newValue) voidsetPropertyValue(String property, Object newValue) Sets a property value on the bean configurationMethods inherited from class groovy.lang.GroovyObjectSupport
getMetaClass, setMetaClassMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface groovy.lang.GroovyObject
invokeMethod
-
Constructor Details
-
DefaultBeanConfiguration
-
DefaultBeanConfiguration
-
DefaultBeanConfiguration
-
DefaultBeanConfiguration
-
DefaultBeanConfiguration
-
DefaultBeanConfiguration
-
DefaultBeanConfiguration
-
-
Method Details
-
getProperty
- Specified by:
getPropertyin interfacegroovy.lang.GroovyObject
-
setProperty
- Specified by:
setPropertyin interfacegroovy.lang.GroovyObject
-
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
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
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
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
- Specified by:
setFactoryBeanin interfaceBeanConfiguration- Returns:
- This BeanConfiguration
-
setFactoryMethod
- Specified by:
setFactoryMethodin interfaceBeanConfiguration- Returns:
- This BeanConfiguration
-
setAutowire
Description copied from interface:BeanConfigurationSets the autowire type, either "byType" or "byName"- Specified by:
setAutowirein interfaceBeanConfiguration- Parameters:
type- The type- Returns:
- This BeanConfiguration
-
setName
Description copied from interface:BeanConfigurationSets the name of the bean in the app ctx.- Specified by:
setNamein interfaceBeanConfiguration- Parameters:
beanName- The bean name
-
getPropertyValue
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
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
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
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
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
-