ch.elca.el4j.util.codingsupport
Class PropertiesHelper

java.lang.Object
  extended by ch.elca.el4j.util.codingsupport.PropertiesHelper

public class PropertiesHelper
extends Object

A helper class which handles the loading and storing of Properties to/from files including Spring path resolving.

The files can be indicated absolutely or via classpath, i.e. either by "file:C:/folder/..." or by "classpath:folder/...".

Author:
Raphael Boog (RBO)
File-location:
PropertiesHelper
Last check-in date:
2009-08-04 15:35:01 +0200 (Di, 04. Aug 2009) by swismer for revision 3883

Constructor Summary
PropertiesHelper()
           
 
Method Summary
 Properties loadProperties(String inputFileName)
          Resolves the given file name to an absolute file name and then loads the properties from this file to a Properties Object.
static Properties loadPropertiesFromResources(Resource[] resources)
          Loads properties from given resources.
 void storeProperties(Properties props, String outputFileName)
          Resolves the given file name to an absolute file name and then stores the properties from the Properties Object to this file.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PropertiesHelper

public PropertiesHelper()
Method Detail

loadPropertiesFromResources

public static Properties loadPropertiesFromResources(Resource[] resources)
Loads properties from given resources. Properties declared in late resources overwrite properties. declared in earlier resources. Invalid resources just get skipped.

Parameters:
resources - the properties files
Returns:
the merged properties

loadProperties

public Properties loadProperties(String inputFileName)
Resolves the given file name to an absolute file name and then loads the properties from this file to a Properties Object.

Parameters:
inputFileName - The file(s) which will be loaded
Returns:
the Properties Object

storeProperties

public void storeProperties(Properties props,
                            String outputFileName)
Resolves the given file name to an absolute file name and then stores the properties from the Properties Object to this file.

Parameters:
props - The Properties Object
outputFileName - The file where the data is stored


Copyright © 2005-2011 ELCA. All Rights Reserved.