Class DictionaryBeanFactoryPostProcessor
java.lang.Object
org.kuali.rice.krad.datadictionary.DictionaryBeanFactoryPostProcessor
Post processor for the data dictionary bean factory
The 'driver' for other post processors. Essentially this iterates through each bean and its properties, making calls to the message and expression processors
- Author:
- Kuali Rice Team (rice.collab@kuali.org)
-
Constructor Summary
ConstructorsConstructorDescriptionDictionaryBeanFactoryPostProcessor(DataDictionary dataDictionary, org.springframework.beans.factory.config.ConfigurableListableBeanFactory beanFactory) Constructs a new processor for the given data dictionary and bean factory -
Method Summary
Modifier and TypeMethodDescriptionprotected org.springframework.beans.factory.config.BeanDefinitiongetBeanDefinition(Object value) Returns the given value as a bean definition (parsing from holder if necessary)protected StringgetBeanName(Object value) Gets the bean name from the given value which is assumed to be a bean definition holderprotected DataDictionaryServiceRetrieves the data dictionary service using the KRAD service locatorprotected StringDetermines whether the given value is of String type and if so returns the string valueprotected booleanisBeanDefinitionValue(Object value) Indicate whether the given value is a bean definition (or holder)protected booleanisCollectionValue(Object value) Indicate whether the given value is a collectionprotected booleanisStringValue(Object value) Indicate whether the given value is a string or holds a stringvoidIterates through all beans in the factory and invokes processing of root bean definitionsprotected StringprocessArrayStringPropertyValue(String propertyName, Object[] propertyValue, String elementValue, int elementIndex, Stack<org.springframework.beans.factory.config.BeanDefinitionHolder> nestedBeanStack, List<DictionaryBeanProcessor> beanProcessors) Invokes the processors to handle an array string value (which may be changed)protected voidprocessBeanProperties(org.springframework.beans.factory.config.BeanDefinition beanDefinition, Stack<org.springframework.beans.factory.config.BeanDefinitionHolder> nestedBeanStack) Iterates through the properties defined for the bean definition and invokes helper methods to process the property valueprotected StringprocessListStringPropertyValue(String propertyName, List<?> propertyValue, String elementValue, int elementIndex, Stack<org.springframework.beans.factory.config.BeanDefinitionHolder> nestedBeanStack, List<DictionaryBeanProcessor> beanProcessors) Invokes the processors to handle an list string value (which may be changed)protected StringprocessMapStringPropertyValue(String propertyName, Map<?, ?> propertyValue, String elementValue, Object elementKey, Stack<org.springframework.beans.factory.config.BeanDefinitionHolder> nestedBeanStack, List<DictionaryBeanProcessor> beanProcessors) Invokes the processors to handle an map string value (which may be changed)voidprocessNestedBeanDefinition(String beanName, org.springframework.beans.factory.config.BeanDefinition beanDefinition, String nestedPropertyPath, boolean isCollectionBean, Stack<org.springframework.beans.factory.config.BeanDefinitionHolder> nestedBeanStack) Invokes the processors to handle the given nested bean definitionprotected voidprocessRootBeanDefinition(String beanName, org.springframework.beans.factory.config.BeanDefinition beanDefinition) Invokes processors to handle the root bean definition then processes the bean propertiesprotected StringprocessSetStringPropertyValue(String propertyName, Set<?> propertyValue, String elementValue, Stack<org.springframework.beans.factory.config.BeanDefinitionHolder> nestedBeanStack, List<DictionaryBeanProcessor> beanProcessors) Invokes the processors to handle an set string value (which may be changed)protected StringprocessStringPropertyValue(String propertyName, String propertyValue, Stack<org.springframework.beans.factory.config.BeanDefinitionHolder> nestedBeanStack) Invokes the processors to handle the string value (which may be changed)protected voidvisitArray(Object array, String propertyName, Stack<org.springframework.beans.factory.config.BeanDefinitionHolder> nestedBeanStack) Iterates through the array values and calls helpers to process the valueprotected voidvisitCollection(Object value, String propertyName, Stack<org.springframework.beans.factory.config.BeanDefinitionHolder> nestedBeanStack) Determines what kind of collection (or array) the given value is and call handlers based on the determined typeprotected voidvisitList(List<?> listVal, String propertyName, Stack<org.springframework.beans.factory.config.BeanDefinitionHolder> nestedBeanStack) Iterates through the list values and calls helpers to process the valueprotected voidvisitMap(Map<?, ?> mapVal, String propertyName, Stack<org.springframework.beans.factory.config.BeanDefinitionHolder> nestedBeanStack) Iterates through the map values and calls helpers to process the valueprotected ObjectvisitPropertyValue(String propertyName, Object propertyValue, Stack<org.springframework.beans.factory.config.BeanDefinitionHolder> nestedBeanStack) Determines if the property value is a bean or collection, and calls the appropriate helper method to process further.protected voidvisitSet(Set setVal, String propertyName, Stack<org.springframework.beans.factory.config.BeanDefinitionHolder> nestedBeanStack) Iterates through the set values and calls helpers to process the value
-
Constructor Details
-
DictionaryBeanFactoryPostProcessor
public DictionaryBeanFactoryPostProcessor(DataDictionary dataDictionary, org.springframework.beans.factory.config.ConfigurableListableBeanFactory beanFactory) Constructs a new processor for the given data dictionary and bean factory- Parameters:
dataDictionary- data dictionary instance that contains the bean factorybeanFactory- bean factory to process
-
-
Method Details
-
postProcessBeanFactory
public void postProcessBeanFactory() throws org.springframework.beans.BeansExceptionIterates through all beans in the factory and invokes processing of root bean definitions- Throws:
org.springframework.beans.BeansException
-
processRootBeanDefinition
protected void processRootBeanDefinition(String beanName, org.springframework.beans.factory.config.BeanDefinition beanDefinition) Invokes processors to handle the root bean definition then processes the bean properties- Parameters:
beanName- name of the bean within the factorybeanDefinition- root bean definition to process
-
processNestedBeanDefinition
public void processNestedBeanDefinition(String beanName, org.springframework.beans.factory.config.BeanDefinition beanDefinition, String nestedPropertyPath, boolean isCollectionBean, Stack<org.springframework.beans.factory.config.BeanDefinitionHolder> nestedBeanStack) Invokes the processors to handle the given nested bean definitionA check is also made to determine if the nested bean has a non-generated id which is not registered in the factory, if so the bean is added as a registered bean (so it can be found by id)
- Parameters:
beanName- name of the nested bean definition in the bean factorybeanDefinition- nested bean definition to processnestedPropertyPath- the property path to the nested bean from the parent bean definitionisCollectionBean- indicates whether the nested bean is in a collection, if so a different handler method is called on the processorsnestedBeanStack- the stack of bean containers(those beans which contain the bean)
-
processStringPropertyValue
protected String processStringPropertyValue(String propertyName, String propertyValue, Stack<org.springframework.beans.factory.config.BeanDefinitionHolder> nestedBeanStack) Invokes the processors to handle the string value (which may be changed)- Parameters:
propertyName- name of the property that is being processedpropertyValue- the string property value to processnestedBeanStack- the stack of bean containers, including the bean that contains the property- Returns:
- String new property value (possibly modified by processors)
-
processArrayStringPropertyValue
protected String processArrayStringPropertyValue(String propertyName, Object[] propertyValue, String elementValue, int elementIndex, Stack<org.springframework.beans.factory.config.BeanDefinitionHolder> nestedBeanStack, List<DictionaryBeanProcessor> beanProcessors) Invokes the processors to handle an array string value (which may be changed)- Parameters:
propertyName- name of the property that is being processedpropertyValue- the array which contains the stringelementValue- the string element valueelementIndex- the index of the string within the arraynestedBeanStack- the stack of bean containers, including the bean that contains the property- Returns:
- String new property value (possibly modified by processors)
-
processListStringPropertyValue
protected String processListStringPropertyValue(String propertyName, List<?> propertyValue, String elementValue, int elementIndex, Stack<org.springframework.beans.factory.config.BeanDefinitionHolder> nestedBeanStack, List<DictionaryBeanProcessor> beanProcessors) Invokes the processors to handle an list string value (which may be changed)- Parameters:
propertyName- name of the property that is being processedpropertyValue- the list which contains the stringelementValue- the string element valueelementIndex- the index of the string within the listnestedBeanStack- the stack of bean containers, including the bean that contains the property- Returns:
- String new property value (possibly modified by processors)
-
processSetStringPropertyValue
protected String processSetStringPropertyValue(String propertyName, Set<?> propertyValue, String elementValue, Stack<org.springframework.beans.factory.config.BeanDefinitionHolder> nestedBeanStack, List<DictionaryBeanProcessor> beanProcessors) Invokes the processors to handle an set string value (which may be changed)- Parameters:
propertyName- name of the property that is being processedpropertyValue- the set which contains the stringelementValue- the string element valuenestedBeanStack- the stack of bean containers, including the bean that contains the property- Returns:
- String new property value (possibly modified by processors)
-
processMapStringPropertyValue
protected String processMapStringPropertyValue(String propertyName, Map<?, ?> propertyValue, String elementValue, Object elementKey, Stack<org.springframework.beans.factory.config.BeanDefinitionHolder> nestedBeanStack, List<DictionaryBeanProcessor> beanProcessors) Invokes the processors to handle an map string value (which may be changed)- Parameters:
propertyName- name of the property that is being processedpropertyValue- the map which contains the stringelementValue- the string element valueelementKey- the key for the string within the mapnestedBeanStack- the stack of bean containers, including the bean that contains the property- Returns:
- String new property value (possibly modified by processors)
-
processBeanProperties
protected void processBeanProperties(org.springframework.beans.factory.config.BeanDefinition beanDefinition, Stack<org.springframework.beans.factory.config.BeanDefinitionHolder> nestedBeanStack) Iterates through the properties defined for the bean definition and invokes helper methods to process the property value- Parameters:
beanDefinition- bean definition whose properties will be processednestedBeanStack- stack of beans which contain the given bean
-
visitPropertyValue
protected Object visitPropertyValue(String propertyName, Object propertyValue, Stack<org.springframework.beans.factory.config.BeanDefinitionHolder> nestedBeanStack) Determines if the property value is a bean or collection, and calls the appropriate helper method to process further. Ultimately this invokes the processors to modify the property value if necessary- Parameters:
propertyName- name for the property being processedpropertyValue- value for the property to processnestedBeanStack- stack of beans which contain the property- Returns:
- Object the new property value (which may be modified0
-
visitCollection
protected void visitCollection(Object value, String propertyName, Stack<org.springframework.beans.factory.config.BeanDefinitionHolder> nestedBeanStack) Determines what kind of collection (or array) the given value is and call handlers based on the determined type- Parameters:
value- collection value to processpropertyName- name of the property which has the collection valuenestedBeanStack- stack of bean containers which contains the collection property
-
visitArray
protected void visitArray(Object array, String propertyName, Stack<org.springframework.beans.factory.config.BeanDefinitionHolder> nestedBeanStack) Iterates through the array values and calls helpers to process the value- Parameters:
array- the array to processpropertyName- name of the property which has the array valuenestedBeanStack- stack of bean containers which contains the array property
-
visitList
protected void visitList(List<?> listVal, String propertyName, Stack<org.springframework.beans.factory.config.BeanDefinitionHolder> nestedBeanStack) Iterates through the list values and calls helpers to process the value- Parameters:
listVal- the list to processpropertyName- name of the property which has the list valuenestedBeanStack- stack of bean containers which contains the list property
-
visitSet
protected void visitSet(Set setVal, String propertyName, Stack<org.springframework.beans.factory.config.BeanDefinitionHolder> nestedBeanStack) Iterates through the set values and calls helpers to process the value- Parameters:
setVal- the set to processpropertyName- name of the property which has the set valuenestedBeanStack- stack of bean containers which contains the set property
-
visitMap
protected void visitMap(Map<?, ?> mapVal, String propertyName, Stack<org.springframework.beans.factory.config.BeanDefinitionHolder> nestedBeanStack) Iterates through the map values and calls helpers to process the value- Parameters:
mapVal- the set to processpropertyName- name of the property which has the map valuenestedBeanStack- stack of bean containers which contains the map property
-
isStringValue
Indicate whether the given value is a string or holds a string- Parameters:
value- value to test- Returns:
- boolean true if the value is a string, false if not
-
getString
Determines whether the given value is of String type and if so returns the string value- Parameters:
value- object value to check- Returns:
- String string value for object or null if object is not a string type
-
isBeanDefinitionValue
Indicate whether the given value is a bean definition (or holder)- Parameters:
value- value to test- Returns:
- boolean true if the value is a bean definition, false if not
-
getBeanDefinition
Returns the given value as a bean definition (parsing from holder if necessary)- Parameters:
value- value to convert- Returns:
- BeanDefinition converted bean definition
-
getBeanName
Gets the bean name from the given value which is assumed to be a bean definition holder- Parameters:
value- value retrieve bean name from- Returns:
- String bean name, or null if value is not a bean definition holder
-
isCollectionValue
Indicate whether the given value is a collection- Parameters:
value- value to test- Returns:
- boolean true if the value is a collection, false if not
-
getDataDictionaryService
Retrieves the data dictionary service using the KRAD service locator- Returns:
- DataDictionaryService instance
-