org.apache.qpid.configuration
Class PropertyUtils

java.lang.Object
  extended by org.apache.qpid.configuration.PropertyUtils

public class PropertyUtils
extends Object

PropertyUtils provides helper methods for dealing with Java properties.

CRC Card
Responsibilities Collaborations
Expand system properties into strings with named expansions.

Todo:
Make the lookup method generic by passing in the properties to use for the expansion, rather than hard coding as system properties. The expansion code has greater potential for re-use that way., Some more property related code could be added to this utils class, which might more appropriately reside under org.apache.qpid.util. For example standardised code to load properties from a resource name, currently found in QpidProperties and possibly other places could be moved here.

Constructor Summary
PropertyUtils()
           
 
Method Summary
static String replaceProperties(String value)
          Given a string that contains substrings of the form ${xxx}, looks up the valuea of 'xxx' as a system properties and substitutes tham back into the original string, to provide a property value expanded string.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PropertyUtils

public PropertyUtils()
Method Detail

replaceProperties

public static String replaceProperties(String value)
                                throws PropertyException
Given a string that contains substrings of the form ${xxx}, looks up the valuea of 'xxx' as a system properties and substitutes tham back into the original string, to provide a property value expanded string.

Parameters:
value - The string to be scanned for property references. May be null, in which case this method returns immediately with no effect.
Returns:
The original string with the properties replaced, or null if the original string is null.
Throws:
PropertyException - If the string contains an opening ${ without a balancing }, or if the property to expand does not exist as a system property.


Licensed to the Apache Software Foundation