com.dtolabs.utils
Class PropertiesUtil

java.lang.Object
  extended by com.dtolabs.utils.PropertiesUtil

public class PropertiesUtil
extends java.lang.Object

PropertiesUtil provides some utility methods for Properties.


Nested Class Summary
static interface PropertiesUtil.Adder
          Adder represents an object that can have properties added to it.
static class PropertiesUtil.PrefixAdder
          A Adder that adds new properties to the input Properties object using a given prefix to prepend to the name of all new properties.
static class PropertiesUtil.PrefixProducer
          A Producer that given an input set of properties and a specific prefix, produces another set of properties from all input properties that have that prefix and removes the prefix.
static interface PropertiesUtil.Producer
          Reader represents an object that can produce Properties.
 
Constructor Summary
PropertiesUtil()
           
 
Method Summary
static java.util.Collection listPropertiesWithPrefix(java.util.Properties props, java.lang.String prefix)
          Returns a Collection of all property values that have keys with a certain prefix.
static java.util.Properties propertiesFromString(java.lang.String propString)
          Convert a String into a Properties object
static java.lang.String stringFromProperties(java.util.Properties props)
          Returns the Properties formatted as a String
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PropertiesUtil

public PropertiesUtil()
Method Detail

stringFromProperties

public static java.lang.String stringFromProperties(java.util.Properties props)
                                             throws java.io.IOException
Returns the Properties formatted as a String

Parameters:
props -
Returns:
String format from the Properties
Throws:
java.io.IOException

propertiesFromString

public static java.util.Properties propertiesFromString(java.lang.String propString)
                                                 throws java.io.IOException
Convert a String into a Properties object

Parameters:
propString -
Returns:
Throws:
java.io.IOException

listPropertiesWithPrefix

public static java.util.Collection listPropertiesWithPrefix(java.util.Properties props,
                                                            java.lang.String prefix)
Returns a Collection of all property values that have keys with a certain prefix.

Parameters:
props - the Properties to reaqd
prefix - the prefix
Returns:
Collection of all property values with keys with a certain prefix