| 
 | ||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.springframework.core.io.support.PropertiesLoaderSupport
org.springframework.beans.factory.config.PropertyResourceConfigurer
org.springframework.beans.factory.config.PropertyOverrideConfigurer
ch.elca.el4j.core.config.ListPropertyMergeConfigurer
public class ListPropertyMergeConfigurer
Adds an entry to a list property of a Spring bean. A file, e.g. "listmerge.properties", whose values are of type "beanName"."propertyName"="value 1", "value 2", ... can be referenced in the bean definition of this class under the property name "location". The defined values will be added to the list with name "propertyName" of the bean with name "beanName".
The postProcessBeanFactory method from abstract class PropertyResourceConfigurer is overridden in order to prevent the properties from being overridden. Another possibility would be to suggest a refactoring of this method in abstract class PropertyResourceConfigurer.
TODO This class handles only lists. Extensions could also manage Maps. A possible pattern for defining map entries in a properties file is (tbd): "bean_name.property_name = key1=value1, key2=value2".
| Field Summary | 
|---|
| Fields inherited from class org.springframework.beans.factory.config.PropertyOverrideConfigurer | 
|---|
| DEFAULT_BEAN_NAME_SEPARATOR | 
| Fields inherited from class org.springframework.core.io.support.PropertiesLoaderSupport | 
|---|
| logger, XML_FILE_EXTENSION | 
| Fields inherited from interface org.springframework.core.Ordered | 
|---|
| HIGHEST_PRECEDENCE, LOWEST_PRECEDENCE | 
| Constructor Summary | |
|---|---|
| ListPropertyMergeConfigurer() | |
| Method Summary | |
|---|---|
| protected  void | addDefaultProperties(Properties mergedProps)Adds default properties to the properties container. | 
| protected  void | applyPropertyValue(ConfigurableListableBeanFactory factory,
                   String beanName,
                   String property,
                   String value) | 
|  String | getFileEncoding() | 
|  Resource[] | getLocations() | 
|  Properties | getProperties() | 
|  PropertiesPersister | getPropertiesPersister() | 
|  boolean | isIgnoreResourceNotFound() | 
|  boolean | isInsertNewItemsAfter()Marks if new items should be pre- or appended to the old values. | 
|  boolean | isInsertNewItemsBefore()Marks if new items should be pre- or appended to the old values. | 
| protected  void | loadProperties(Properties mergedProps,
               Resource location)Loads the properties from the given location. | 
|  void | postProcessBeanFactory(ConfigurableListableBeanFactory beanFactory) | 
|  void | setFileEncoding(String encoding) | 
|  void | setIgnoreResourceNotFound(boolean ignoreResourceNotFound) | 
|  void | setInsertNewItemsAfter(boolean insertNewItemsAfter)Marks if new items should be pre- or appended to the old values. | 
|  void | setInsertNewItemsBefore(boolean insertNewItemsBefore)Marks if new items should be pre- or appended to the old values. | 
|  void | setLocation(Resource location) | 
|  void | setLocations(Resource[] locations) | 
|  void | setProperties(Properties properties) | 
|  void | setPropertiesPersister(PropertiesPersister propertiesPersister) | 
| Methods inherited from class org.springframework.beans.factory.config.PropertyOverrideConfigurer | 
|---|
| hasPropertyOverridesFor, processKey, processProperties, setBeanNameSeparator, setIgnoreInvalidKeys | 
| Methods inherited from class org.springframework.beans.factory.config.PropertyResourceConfigurer | 
|---|
| convertProperties, convertProperty, convertPropertyValue, getOrder, setOrder | 
| Methods inherited from class org.springframework.core.io.support.PropertiesLoaderSupport | 
|---|
| loadProperties, mergeProperties, setLocalOverride, setPropertiesArray | 
| Methods inherited from class java.lang.Object | 
|---|
| clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait | 
| Constructor Detail | 
|---|
public ListPropertyMergeConfigurer()
| Method Detail | 
|---|
public final void setProperties(Properties properties)
setProperties in class PropertiesLoaderSupportpublic final void setLocation(Resource location)
setLocation in class PropertiesLoaderSupportpublic final void setLocations(Resource[] locations)
setLocations in class PropertiesLoaderSupportpublic final void setFileEncoding(String encoding)
setFileEncoding in class PropertiesLoaderSupportpublic final void setPropertiesPersister(PropertiesPersister propertiesPersister)
setPropertiesPersister in class PropertiesLoaderSupportpublic final void setIgnoreResourceNotFound(boolean ignoreResourceNotFound)
setIgnoreResourceNotFound in class PropertiesLoaderSupportpublic final String getFileEncoding()
public final boolean isIgnoreResourceNotFound()
public final Resource[] getLocations()
public final Properties getProperties()
public final PropertiesPersister getPropertiesPersister()
public final boolean isInsertNewItemsAfter()
public final void setInsertNewItemsAfter(boolean insertNewItemsAfter)
insertNewItemsAfter - The insertNewItemsAfter to set.public final boolean isInsertNewItemsBefore()
isInsertNewItemsAfter.
isInsertNewItemsAfter()public final void setInsertNewItemsBefore(boolean insertNewItemsBefore)
setInsertNewItemsAfter.
insertNewItemsBefore - The insertNewItemsBefore to set.setInsertNewItemsAfter(boolean)public void postProcessBeanFactory(ConfigurableListableBeanFactory beanFactory)
postProcessBeanFactory in interface BeanFactoryPostProcessorpostProcessBeanFactory in class PropertyResourceConfigurerprotected void addDefaultProperties(Properties mergedProps)
mergedProps - Is the properties container to write into.
protected void loadProperties(Properties mergedProps,
                              Resource location)
mergedProps - Is the properties container to write into.location - Is the resource location to read properties from.
protected void applyPropertyValue(ConfigurableListableBeanFactory factory,
                                  String beanName,
                                  String property,
                                  String value)
applyPropertyValue in class PropertyOverrideConfigurer| 
 | ||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||