public class MessageBeanProcessor extends DictionaryBeanProcessorBase
Constructor and Description |
---|
MessageBeanProcessor(DataDictionary dataDictionary,
org.springframework.beans.factory.config.ConfigurableListableBeanFactory beanFactory) |
Modifier and Type | Method and Description |
---|---|
protected void |
applyMessageTextToPropertyValue(String propertyName,
String messageText,
org.springframework.beans.factory.config.BeanDefinition beanDefinition)
Applies the given message text to the bean definition with the given property name, if a current
value exists for the property name the value is checked for expressions which are then merged with
the message
|
protected void |
applyMessageToBean(Message message,
org.springframework.beans.factory.config.BeanDefinition beanDefinition,
Class<?> beanClass)
Applies the text for a given message to the associated bean definition property
|
protected void |
applyMessageToNestedBean(Message message,
org.springframework.beans.factory.config.BeanDefinition beanDefinition,
String propertyPath)
Applies the given message text to the property within the given bean definition
|
protected void |
applyMessageToNestedListBean(Message message,
List<?> listPropertyValue,
String propertyPath)
Applies a message to a nested list bean definition
|
protected String |
findPropertyValueInBeanDefinition(org.springframework.beans.factory.config.BeanDefinition beanDefinition,
String propertyName)
Attempts to find a property value for the given property name within the bean definition, if the property
does not exist in the bean and there is a parent, the parent is checked for containing the property.
|
protected String |
getComponentForBean(String beanName,
org.springframework.beans.factory.config.BeanDefinition beanDefinition)
Retrieves the component code associated with the bean definition
|
protected String |
getMergedMessageText(String messageText,
String propertyValue)
Prepares the message text that will replace the property value checking for any expression placeholders
|
protected MessageService |
getMessageService()
Returns instance of the Message Service
|
protected String |
getMessageTextForKey(String messageKeyStr,
Stack<org.springframework.beans.factory.config.BeanDefinitionHolder> nestedBeanStack)
Retrieves the test associated with the message give by the message key string
|
protected String |
getNamespaceForBean(String beanName,
org.springframework.beans.factory.config.BeanDefinition beanDefinition)
Retrieves the namespace associated with the bean definition
|
protected String |
getNamespaceForBeanInStack(Stack<org.springframework.beans.factory.config.BeanDefinitionHolder> nestedBeanStack)
Walks up the stack of bean definitions until a namespace is found and returns that namespace
|
protected boolean |
isBeanMessageMatch(String matchListIdentifierPropertyValue,
org.springframework.beans.factory.config.BeanDefinition beanDefinition)
Determines whether the given bean definition is a matched based on the given identifier value
|
String |
processArrayStringPropertyValue(String propertyName,
Object[] propertyValue,
String elementValue,
int elementIndex,
Stack<org.springframework.beans.factory.config.BeanDefinitionHolder> nestedBeanStack)
Invokes the processors to handle an array string value (which may be changed)
|
protected void |
processBeanMessages(String beanName,
org.springframework.beans.factory.config.BeanDefinition beanDefinition,
Stack<org.springframework.beans.factory.config.BeanDefinitionHolder> nestedBeanStack)
Retrieves external messages whose namespace and component matches the bean definition and applies
the message text to the bean property values
|
void |
processCollectionBeanDefinition(String beanName,
org.springframework.beans.factory.config.BeanDefinition beanDefinition,
String propertyName,
Stack<org.springframework.beans.factory.config.BeanDefinitionHolder> nestedBeanStack)
Invoked to process a collection value that is a bean definition
|
String |
processListStringPropertyValue(String propertyName,
List<?> propertyValue,
String elementValue,
int elementIndex,
Stack<org.springframework.beans.factory.config.BeanDefinitionHolder> nestedBeanStack)
Invokes the processors to handle an list string value (which may be changed)
|
String |
processMapStringPropertyValue(String propertyName,
Map<?,?> propertyValue,
String elementValue,
Object elementKey,
Stack<org.springframework.beans.factory.config.BeanDefinitionHolder> nestedBeanStack)
Invokes the processors to handle an map string value (which may be changed)
|
protected String |
processMessagePlaceholders(String propertyValue,
Stack<org.springframework.beans.factory.config.BeanDefinitionHolder> nestedBeanStack)
Checks a string property value for a message placeholder and if found the message is retrieved and updated
in the property value
|
void |
processNestedBeanDefinition(String beanName,
org.springframework.beans.factory.config.BeanDefinition beanDefinition,
String propertyName,
Stack<org.springframework.beans.factory.config.BeanDefinitionHolder> nestedBeanStack)
Invoked to process a nested bean definition (a bean definition that is a property value of another
bean definition)
|
void |
processRootBeanDefinition(String beanName,
org.springframework.beans.factory.config.BeanDefinition beanDefinition)
Invoked to process a root bean definition (a root bean definition is a top level bean)
|
String |
processSetStringPropertyValue(String propertyName,
Set<?> propertyValue,
String elementValue,
Stack<org.springframework.beans.factory.config.BeanDefinitionHolder> nestedBeanStack)
Invokes the processors to handle an set string value (which may be changed)
|
String |
processStringPropertyValue(String propertyName,
String propertyValue,
Stack<org.springframework.beans.factory.config.BeanDefinitionHolder> nestedBeanStack)
Invoked to process a string property value (straight property value, not a string within a collection)
|
applyPropertyValueToBean, applyPropertyValueToBean, getBeanClass, getDataDictionaryService, getPropertyValueBeanDefinition, getStringValue, isGeneratedBeanName
public MessageBeanProcessor(DataDictionary dataDictionary, org.springframework.beans.factory.config.ConfigurableListableBeanFactory beanFactory)
public void processRootBeanDefinition(String beanName, org.springframework.beans.factory.config.BeanDefinition beanDefinition)
DictionaryBeanProcessor
beanName
- name of the bean within the factorybeanDefinition
- bean definition to processDictionaryBeanProcessor.processRootBeanDefinition(java.lang.String,
org.springframework.beans.factory.config.BeanDefinition)
public void processNestedBeanDefinition(String beanName, org.springframework.beans.factory.config.BeanDefinition beanDefinition, String propertyName, Stack<org.springframework.beans.factory.config.BeanDefinitionHolder> nestedBeanStack)
beanName
- name of the bean within the factorybeanDefinition
- bean definition to processpropertyName
- the name of the property which has the bean definition valuenestedBeanStack
- the stack of beans which contain the given beanpublic String processStringPropertyValue(String propertyName, String propertyValue, Stack<org.springframework.beans.factory.config.BeanDefinitionHolder> nestedBeanStack)
propertyName
- name of the property whose string value is being processedpropertyValue
- string value for the propertypublic void processCollectionBeanDefinition(String beanName, org.springframework.beans.factory.config.BeanDefinition beanDefinition, String propertyName, Stack<org.springframework.beans.factory.config.BeanDefinitionHolder> nestedBeanStack)
beanName
- name of the bean within the factorybeanDefinition
- bean definition within the collection to processpropertyName
- the name of the property which has the collection valuenestedBeanStack
- the stack of beans which contain the given collection (and collection bean)public String processArrayStringPropertyValue(String propertyName, Object[] propertyValue, String elementValue, int elementIndex, Stack<org.springframework.beans.factory.config.BeanDefinitionHolder> nestedBeanStack)
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 propertypublic String processListStringPropertyValue(String propertyName, List<?> propertyValue, String elementValue, int elementIndex, Stack<org.springframework.beans.factory.config.BeanDefinitionHolder> nestedBeanStack)
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 propertypublic String processSetStringPropertyValue(String propertyName, Set<?> propertyValue, String elementValue, Stack<org.springframework.beans.factory.config.BeanDefinitionHolder> nestedBeanStack)
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 propertypublic String processMapStringPropertyValue(String propertyName, Map<?,?> propertyValue, String elementValue, Object elementKey, Stack<org.springframework.beans.factory.config.BeanDefinitionHolder> nestedBeanStack)
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 processBeanMessages(String beanName, org.springframework.beans.factory.config.BeanDefinition beanDefinition, Stack<org.springframework.beans.factory.config.BeanDefinitionHolder> nestedBeanStack)
beanName
- name of the bean to processbeanDefinition
- bean definition to processnestedBeanStack
- stack of beans that contain the given bean, used for finding a namespaceprotected void applyMessageToBean(Message message, org.springframework.beans.factory.config.BeanDefinition beanDefinition, Class<?> beanClass)
message
- message instance to applybeanDefinition
- bean definition the message should be applied tobeanClass
- class for the bean definitionprotected void applyMessageToNestedBean(Message message, org.springframework.beans.factory.config.BeanDefinition beanDefinition, String propertyPath)
The message text is applied to the bean definiton based on the property path. The path could be nested in which case the property values of the bean definition are traversed to find the nested bean definition that should hold the property value. The path could also represent a nested list bean. In this case a helper method is called to find the correct list bean to apply the message to
message
- message containing the text to applybeanDefinition
- bean definition containing the propertypropertyPath
- path to property within the bean definition the message should be applied toprotected void applyMessageToNestedListBean(Message message, List<?> listPropertyValue, String propertyPath)
Here the property path first gives an identifier value (such as property name) to use for finding the bean definition with the list the message should apply to. Any part of the path after the identifier value is treated like a nested property path
message
- message instance that contains the text to applylistPropertyValue
- property value list that should contain the bean definition the message
will be applied topropertyPath
- path to the bean definition the message should apply toprotected boolean isBeanMessageMatch(String matchListIdentifierPropertyValue, org.springframework.beans.factory.config.BeanDefinition beanDefinition)
Based on the class for the bean definition an identifier property name is used, the corresponding value from the bean definition is then retrieved and compared to the given value to determine whether the bean definition is a match
matchListIdentifierPropertyValue
- property value to match bean definitions onbeanDefinition
- bean definition to determine the match forprotected String findPropertyValueInBeanDefinition(org.springframework.beans.factory.config.BeanDefinition beanDefinition, String propertyName)
beanDefinition
- bean definition to find property value inpropertyName
- name of the property to find the value forprotected String processMessagePlaceholders(String propertyValue, Stack<org.springframework.beans.factory.config.BeanDefinitionHolder> nestedBeanStack)
propertyValue
- string value to process for message placeholdersnestedBeanStack
- stack of bean definitions that contain the property, used to determine the namespace
and component for the message retrievalprotected String getMessageTextForKey(String messageKeyStr, Stack<org.springframework.beans.factory.config.BeanDefinitionHolder> nestedBeanStack)
messageKeyStr
- key string for the message, can contain just the key, or also the component and/or
namespace. If component or namespace not given it is determined from the bean stacknestedBeanStack
- bean stack that contains the property for which the message appliesprotected void applyMessageTextToPropertyValue(String propertyName, String messageText, org.springframework.beans.factory.config.BeanDefinition beanDefinition)
propertyName
- - name of the property to set on the bean definitionmessageText
- - message text that will be the property valuebeanDefinition
- - bean definition to set property onprotected String getMergedMessageText(String messageText, String propertyValue)
The message text may contain placeholders (using brace delimiters) for expression placement. It is expected when these placeholders are given the property value contains the expressions (using the expression placeholders) that will be inserted into the message text
messageText
- - raw text of the messagepropertyValue
- - current value for the propertyprotected String getNamespaceForBeanInStack(Stack<org.springframework.beans.factory.config.BeanDefinitionHolder> nestedBeanStack)
nestedBeanStack
- stack of bean definitions to find namespace forprotected String getNamespaceForBean(String beanName, org.springframework.beans.factory.config.BeanDefinition beanDefinition)
beanName
- name of the bean to find namespace forbeanDefinition
- bean definition to find namespace forprotected String getComponentForBean(String beanName, org.springframework.beans.factory.config.BeanDefinition beanDefinition)
beanName
- name of the bean to find component code forbeanDefinition
- bean definition to find component code forprotected MessageService getMessageService()
Copyright © 2005–2015 The Kuali Foundation. All rights reserved.