com.scooterframework.common.util
Class PropertyFileUtil

java.lang.Object
  extended by com.scooterframework.common.util.PropertyFileUtil

public class PropertyFileUtil
extends java.lang.Object

PropertyFileUtil


Constructor Summary
PropertyFileUtil()
           
 
Method Summary
static java.util.Properties loadOrderedPropertiesFromFile(java.lang.String fullFileName)
          Load all properties from a file
static java.util.Properties loadPropertiesFromFile(java.lang.String fullFileName)
          Load all properties from a file
static java.util.Properties loadPropertiesFromResource(java.lang.String resourceName)
          Load all properties from a file on classpath
static java.util.Properties parseNestedPropertiesFromLine(java.lang.String line, java.lang.String nameValueSpliter, java.lang.String propertyDelimiter)
          Returns properties from a nested property line.
static void printAllProperties(java.util.Properties pp, java.lang.String nameValueSpliter, java.lang.String propertyDelimiter)
          print out all properties.
static void printAllProperties(java.util.ResourceBundle rb)
          print out all properties.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PropertyFileUtil

public PropertyFileUtil()
Method Detail

loadPropertiesFromResource

public static java.util.Properties loadPropertiesFromResource(java.lang.String resourceName)
                                                       throws java.lang.Exception
Load all properties from a file on classpath

Parameters:
resourceName - a name for a resource on classpath
Returns:
properties in the resource
Throws:
java.lang.Exception

loadPropertiesFromFile

public static java.util.Properties loadPropertiesFromFile(java.lang.String fullFileName)
                                                   throws java.lang.Exception
Load all properties from a file

Parameters:
fullFileName - full name of the file
Returns:
properties in the resource
Throws:
java.lang.Exception

loadOrderedPropertiesFromFile

public static java.util.Properties loadOrderedPropertiesFromFile(java.lang.String fullFileName)
                                                          throws java.lang.Exception
Load all properties from a file

Parameters:
fullFileName - full name of the file
Returns:
properties in the resource
Throws:
java.lang.Exception

printAllProperties

public static void printAllProperties(java.util.ResourceBundle rb)
print out all properties.


printAllProperties

public static void printAllProperties(java.util.Properties pp,
                                      java.lang.String nameValueSpliter,
                                      java.lang.String propertyDelimiter)
print out all properties.


parseNestedPropertiesFromLine

public static java.util.Properties parseNestedPropertiesFromLine(java.lang.String line,
                                                                 java.lang.String nameValueSpliter,
                                                                 java.lang.String propertyDelimiter)
Returns properties from a nested property line.

Examples: For a property line routes.name.login=url=login, controller=home, action=new, the key of the property is routes.name.login, the nested key/value paires are url/login, controller/home, and action/new.

Parameters:
line - a string of properties
nameValueSpliter - a short string that separates name and value elements in a pair
propertyDelimiter - a char that separates pairs in a string line
Returns:
properties