com.ebmwebsourcing.easycommons.properties
Class PropertiesHelper

java.lang.Object
  extended by com.ebmwebsourcing.easycommons.properties.PropertiesHelper

public final class PropertiesHelper
extends java.lang.Object

Utility to handle a CDK properties file.


Constructor Summary
PropertiesHelper()
           
 
Method Summary
static java.util.Map<java.lang.String,java.lang.String> flattenProperties(java.util.Properties properties)
          Get a flat view of a Properties object including recursively, default properties if any.
static void resolveMap(java.util.Map<java.lang.String,java.lang.String> mapToResolve, java.util.Properties propertiesToUse)
          Resolve the place holders in the values of the specified Map mapToResolve against the specified Properties propertiesToUse
static void resolveMapWithNoException(java.util.Map<java.lang.String,java.lang.String> mapToResolve, java.util.Properties propertiesToUse)
          Resolve the place holders in the values of the specified Map mapToResolve against the specified Properties propertiesToUse.
static void resolveProperties(java.util.Properties propertiesToResolve, java.util.Properties propertiesToUse)
          Resolve the specified Properties propertiesToResolve against the specified Properties propertiesToUse
static java.io.ByteArrayInputStream resolvePropertiesForInputStream(java.io.InputStream inputStreamToResolve, java.util.Properties propertiesToUse)
          Resolve the place holders in the values of the specified InputStream inputStreamToResolve against the specified Properties propertiesToUse
static java.lang.String resolveString(java.lang.String str, java.util.Properties propertiesToUse)
          Replace the place holders by their values in the specified string str
 
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

resolveProperties

public static final void resolveProperties(java.util.Properties propertiesToResolve,
                                           java.util.Properties propertiesToUse)
                                    throws PropertiesException
Resolve the specified Properties propertiesToResolve against the specified Properties propertiesToUse

Parameters:
propertiesToResolve - the Properties to resolve (which contain place holders)
propertiesToUse - the Properties to use to resolve
Throws:
PropertiesException - if an error occurs when resolving the Properties

resolvePropertiesForInputStream

public static final java.io.ByteArrayInputStream resolvePropertiesForInputStream(java.io.InputStream inputStreamToResolve,
                                                                                 java.util.Properties propertiesToUse)
                                                                          throws java.io.IOException,
                                                                                 PropertiesException
Resolve the place holders in the values of the specified InputStream inputStreamToResolve against the specified Properties propertiesToUse

Parameters:
inputStreamToResolve - the InputStream containing properties value with place holders to resolve
propertiesToUse - the Properties to use to resolve
Throws:
PropertiesException - if an error occurs when resolving the Properties IOException
java.io.IOException

resolveMap

public static final void resolveMap(java.util.Map<java.lang.String,java.lang.String> mapToResolve,
                                    java.util.Properties propertiesToUse)
                             throws PropertiesException
Resolve the place holders in the values of the specified Map mapToResolve against the specified Properties propertiesToUse

Parameters:
mapToResolve - the Map containing string value with place holders to resolve
propertiesToUse - the Properties to use to resolve
Throws:
PropertiesException - if an error occurs when resolving the Properties

resolveMapWithNoException

public static final void resolveMapWithNoException(java.util.Map<java.lang.String,java.lang.String> mapToResolve,
                                                   java.util.Properties propertiesToUse)
Resolve the place holders in the values of the specified Map mapToResolve against the specified Properties propertiesToUse. If the place holders of a string value cannot be resolved, the string value is not modified in the map.

Parameters:
mapToResolve - the Map containing string value with place holders to resolve
propertiesToUse - the Properties to use to resolve

resolveString

public static final java.lang.String resolveString(java.lang.String str,
                                                   java.util.Properties propertiesToUse)
                                            throws PropertiesException
Replace the place holders by their values in the specified string str

Parameters:
str - a string containing place holders
propertiesToUse - the Properties to resolve (which contains place holders)
Returns:
the string where the place holders have been replaces by their values
Throws:
PropertiesException - if an error occurs when resolving a place holder

flattenProperties

public static final java.util.Map<java.lang.String,java.lang.String> flattenProperties(java.util.Properties properties)
Get a flat view of a Properties object including recursively, default properties if any.

Parameters:
properties - Properties to consider.
Returns:
Flatten properties in a single Map.


Copyright © 2011 Petals Link. All Rights Reserved.