|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.kuali.rice.krad.uif.util.UifBeanFactoryPostProcessor
public class UifBeanFactoryPostProcessor
Post processes the bean factory to handle UIF property expressions
Conditional logic can be implemented with the UIF dictionary by means of property expressions. These are expressions that follow SPEL and can be given as the value for a property using the @{} placeholder. Since such a value would cause an exception when creating the object if the property is a non-string type (value cannot be converted), we need to move those expressions to a Map for processing, and then remove the original property configuration containing the expression. The expressions are then evaluated during the view apply model phase and the result is set as the value for the corresponding property.
Constructor Summary | |
---|---|
UifBeanFactoryPostProcessor()
|
Method Summary | |
---|---|
protected Class<?> |
getBeanClass(org.springframework.beans.factory.config.BeanDefinition beanDefinition,
org.springframework.beans.factory.config.ConfigurableListableBeanFactory beanFactory)
Retrieves the class for the object that will be created from the bean definition. |
protected Map<String,String> |
getPropertyExpressionsFromParent(String parentBeanName,
org.springframework.beans.factory.config.ConfigurableListableBeanFactory beanFactory,
Set<String> processedBeanNames)
Retrieves the property expressions map set on the bean with given name. |
protected String |
getStringValue(Object value)
Determines whether the given value is of String type and if so returns the string value |
protected boolean |
hasExpression(Object propertyValue)
Checks whether the given property value is of String type, and if so whether it contains the expression placholder(s) |
void |
postProcessBeanFactory(org.springframework.beans.factory.config.ConfigurableListableBeanFactory beanFactory)
Iterates through all beans in the factory and invokes processing for expressions |
protected void |
processBeanDefinition(String beanName,
org.springframework.beans.factory.config.BeanDefinition beanDefinition,
org.springframework.beans.factory.config.ConfigurableListableBeanFactory beanFactory,
Set<String> processedBeanNames)
If the bean class is type Component, LayoutManager, or BindingInfo, iterate through configured property values and check for expressions |
protected Object |
processPropertyValue(String propertyName,
Object propertyValue,
Map<String,String> parentPropertyExpressions,
Map<String,String> propertyExpressions,
org.springframework.beans.factory.config.ConfigurableListableBeanFactory beanFactory,
Set<String> processedBeanNames)
Processes the given property name/value pair for complex objects, such as bean definitions or collections, which if found will be processed for contained property expression values |
protected void |
removeExpressionsByPrefix(String propertyNamePrefix,
Map<String,String> propertyExpressions)
Removes entries from the given expressions map whose key starts with the given prefix |
protected void |
removeParentExpressionsOnNested(String propertyName,
org.springframework.beans.MutablePropertyValues pvs,
String parentBeanName,
org.springframework.beans.factory.config.ConfigurableListableBeanFactory beanFactory)
|
protected void |
visitArray(String propertyName,
Map<String,String> parentPropertyExpressions,
Map<String,String> propertyExpressions,
Object[] arrayVal,
org.springframework.beans.factory.config.ConfigurableListableBeanFactory beanFactory,
Set<String> processedBeanNames)
|
protected void |
visitList(String propertyName,
Map<String,String> parentPropertyExpressions,
Map<String,String> propertyExpressions,
List listVal,
org.springframework.beans.factory.config.ConfigurableListableBeanFactory beanFactory,
Set<String> processedBeanNames)
|
protected void |
visitMap(String propertyName,
Map<String,String> parentPropertyExpressions,
Map<String,String> propertyExpressions,
Map<?,?> mapVal,
org.springframework.beans.factory.config.ConfigurableListableBeanFactory beanFactory,
Set<String> processedBeanNames)
|
protected void |
visitSet(String propertyName,
Map<String,String> parentPropertyExpressions,
Map<String,String> propertyExpressions,
Set setVal,
org.springframework.beans.factory.config.ConfigurableListableBeanFactory beanFactory,
Set<String> processedBeanNames)
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public UifBeanFactoryPostProcessor()
Method Detail |
---|
public void postProcessBeanFactory(org.springframework.beans.factory.config.ConfigurableListableBeanFactory beanFactory) throws org.springframework.beans.BeansException
postProcessBeanFactory
in interface org.springframework.beans.factory.config.BeanFactoryPostProcessor
beanFactory
- - bean factory instance to process
org.springframework.beans.BeansException
protected void processBeanDefinition(String beanName, org.springframework.beans.factory.config.BeanDefinition beanDefinition, org.springframework.beans.factory.config.ConfigurableListableBeanFactory beanFactory, Set<String> processedBeanNames)
If a expression is found for a property, it is added to the 'propertyExpressions' map and then the original property value is removed to prevent binding errors (when converting to a non string type)
beanName
- - name of the bean in the factory (only set for top level beans, not nested)beanDefinition
- - bean definition to process for expressionsbeanFactory
- - bean factory being processedprotected void removeParentExpressionsOnNested(String propertyName, org.springframework.beans.MutablePropertyValues pvs, String parentBeanName, org.springframework.beans.factory.config.ConfigurableListableBeanFactory beanFactory)
protected Class<?> getBeanClass(org.springframework.beans.factory.config.BeanDefinition beanDefinition, org.springframework.beans.factory.config.ConfigurableListableBeanFactory beanFactory)
beanDefinition
- - bean definition to get class forbeanFactory
- - bean factory that contains the bean definition
protected Map<String,String> getPropertyExpressionsFromParent(String parentBeanName, org.springframework.beans.factory.config.ConfigurableListableBeanFactory beanFactory, Set<String> processedBeanNames)
parentBeanName
- - name of the parent bean to retrieve map for (if empty a new map will be returned)beanFactory
- - bean factory to retrieve bean definition fromprocessedBeanNames
- - set of bean names that have been processed so far
protected boolean hasExpression(Object propertyValue)
propertyValue
- - value to check for expressions
protected Object processPropertyValue(String propertyName, Object propertyValue, Map<String,String> parentPropertyExpressions, Map<String,String> propertyExpressions, org.springframework.beans.factory.config.ConfigurableListableBeanFactory beanFactory, Set<String> processedBeanNames)
propertyName
- - name of the property whose value is being processedpropertyValue
- - value to checkparentPropertyExpressions
- - map that holds property expressions for the parent bean definition, used for
mergingpropertyExpressions
- - map that holds property expressions for the bean definition being processedbeanFactory
- - bean factory that contains the bean definition being processedprocessedBeanNames
- - set of bean names that have been processed so far
protected void removeExpressionsByPrefix(String propertyNamePrefix, Map<String,String> propertyExpressions)
propertyNamePrefix
- - prefix to search for and removepropertyExpressions
- - map of property expressions to filterprotected String getStringValue(Object value)
value
- - object value to check
protected void visitArray(String propertyName, Map<String,String> parentPropertyExpressions, Map<String,String> propertyExpressions, Object[] arrayVal, org.springframework.beans.factory.config.ConfigurableListableBeanFactory beanFactory, Set<String> processedBeanNames)
protected void visitList(String propertyName, Map<String,String> parentPropertyExpressions, Map<String,String> propertyExpressions, List listVal, org.springframework.beans.factory.config.ConfigurableListableBeanFactory beanFactory, Set<String> processedBeanNames)
protected void visitSet(String propertyName, Map<String,String> parentPropertyExpressions, Map<String,String> propertyExpressions, Set setVal, org.springframework.beans.factory.config.ConfigurableListableBeanFactory beanFactory, Set<String> processedBeanNames)
protected void visitMap(String propertyName, Map<String,String> parentPropertyExpressions, Map<String,String> propertyExpressions, Map<?,?> mapVal, org.springframework.beans.factory.config.ConfigurableListableBeanFactory beanFactory, Set<String> processedBeanNames)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |