public class DictionaryBeanFactoryPostProcessor extends Object
The 'driver' for other post processors. Essentially this iterates through each bean and its properties, making calls to the message and expression processors
Constructor and Description |
---|
DictionaryBeanFactoryPostProcessor(DataDictionary dataDictionary,
org.springframework.beans.factory.config.ConfigurableListableBeanFactory beanFactory)
Constructs a new processor for the given data dictionary and bean factory
|
Modifier and Type | Method and Description |
---|---|
protected org.springframework.beans.factory.config.BeanDefinition |
getBeanDefinition(Object value)
Returns the given value as a bean definition (parsing from holder if necessary)
|
protected String |
getBeanName(Object value)
Gets the bean name from the given value which is assumed to be a bean definition holder
|
protected DataDictionaryService |
getDataDictionaryService()
Retrieves the data dictionary service using the KRAD service locator
|
protected String |
getString(Object value)
Determines whether the given value is of String type and if so returns the string value
|
protected boolean |
isBeanDefinitionValue(Object value)
Indicate whether the given value is a bean definition (or holder)
|
protected boolean |
isCollectionValue(Object value)
Indicate whether the given value is a collection
|
protected boolean |
isStringValue(Object value)
Indicate whether the given value is a string or holds a string
|
void |
postProcessBeanFactory()
Iterates through all beans in the factory and invokes processing of root bean definitions
|
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)
|
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
|
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)
|
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)
|
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 definition
|
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
|
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)
|
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)
|
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
|
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
|
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
|
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
|
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.
|
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
|
public DictionaryBeanFactoryPostProcessor(DataDictionary dataDictionary, org.springframework.beans.factory.config.ConfigurableListableBeanFactory beanFactory)
dataDictionary
- data dictionary instance that contains the bean factorybeanFactory
- bean factory to processpublic void postProcessBeanFactory() throws org.springframework.beans.BeansException
org.springframework.beans.BeansException
protected void processRootBeanDefinition(String beanName, org.springframework.beans.factory.config.BeanDefinition beanDefinition)
beanName
- name of the bean within the factorybeanDefinition
- root bean definition to processpublic void processNestedBeanDefinition(String beanName, org.springframework.beans.factory.config.BeanDefinition beanDefinition, String nestedPropertyPath, boolean isCollectionBean, Stack<org.springframework.beans.factory.config.BeanDefinitionHolder> nestedBeanStack)
A 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)
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)protected String processStringPropertyValue(String propertyName, String propertyValue, Stack<org.springframework.beans.factory.config.BeanDefinitionHolder> nestedBeanStack)
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 propertyprotected String processArrayStringPropertyValue(String propertyName, Object[] propertyValue, String elementValue, int elementIndex, Stack<org.springframework.beans.factory.config.BeanDefinitionHolder> nestedBeanStack, List<DictionaryBeanProcessor> beanProcessors)
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 propertyprotected String processListStringPropertyValue(String propertyName, List<?> propertyValue, String elementValue, int elementIndex, Stack<org.springframework.beans.factory.config.BeanDefinitionHolder> nestedBeanStack, List<DictionaryBeanProcessor> beanProcessors)
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 propertyprotected String processSetStringPropertyValue(String propertyName, Set<?> propertyValue, String elementValue, Stack<org.springframework.beans.factory.config.BeanDefinitionHolder> nestedBeanStack, List<DictionaryBeanProcessor> beanProcessors)
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 propertyprotected String processMapStringPropertyValue(String propertyName, Map<?,?> propertyValue, String elementValue, Object elementKey, Stack<org.springframework.beans.factory.config.BeanDefinitionHolder> nestedBeanStack, List<DictionaryBeanProcessor> beanProcessors)
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 propertyprotected void processBeanProperties(org.springframework.beans.factory.config.BeanDefinition beanDefinition, Stack<org.springframework.beans.factory.config.BeanDefinitionHolder> nestedBeanStack)
beanDefinition
- bean definition whose properties will be processednestedBeanStack
- stack of beans which contain the given beanprotected Object visitPropertyValue(String propertyName, Object propertyValue, Stack<org.springframework.beans.factory.config.BeanDefinitionHolder> nestedBeanStack)
propertyName
- name for the property being processedpropertyValue
- value for the property to processnestedBeanStack
- stack of beans which contain the propertyprotected void visitCollection(Object value, String propertyName, Stack<org.springframework.beans.factory.config.BeanDefinitionHolder> nestedBeanStack)
value
- collection value to processpropertyName
- name of the property which has the collection valuenestedBeanStack
- stack of bean containers which contains the collection propertyprotected void visitArray(Object array, String propertyName, Stack<org.springframework.beans.factory.config.BeanDefinitionHolder> nestedBeanStack)
array
- the array to processpropertyName
- name of the property which has the array valuenestedBeanStack
- stack of bean containers which contains the array propertyprotected void visitList(List<?> listVal, String propertyName, Stack<org.springframework.beans.factory.config.BeanDefinitionHolder> nestedBeanStack)
listVal
- the list to processpropertyName
- name of the property which has the list valuenestedBeanStack
- stack of bean containers which contains the list propertyprotected void visitSet(Set setVal, String propertyName, Stack<org.springframework.beans.factory.config.BeanDefinitionHolder> nestedBeanStack)
setVal
- the set to processpropertyName
- name of the property which has the set valuenestedBeanStack
- stack of bean containers which contains the set propertyprotected void visitMap(Map<?,?> mapVal, String propertyName, Stack<org.springframework.beans.factory.config.BeanDefinitionHolder> nestedBeanStack)
mapVal
- the set to processpropertyName
- name of the property which has the map valuenestedBeanStack
- stack of bean containers which contains the map propertyprotected boolean isStringValue(Object value)
value
- value to testprotected String getString(Object value)
value
- object value to checkprotected boolean isBeanDefinitionValue(Object value)
value
- value to testprotected org.springframework.beans.factory.config.BeanDefinition getBeanDefinition(Object value)
value
- value to convertprotected String getBeanName(Object value)
value
- value retrieve bean name fromprotected boolean isCollectionValue(Object value)
value
- value to testprotected DataDictionaryService getDataDictionaryService()
Copyright © 2005–2015 The Kuali Foundation. All rights reserved.