org.apache.cocoon.configuration
Class PropertyHelper

java.lang.Object
  extended byorg.apache.cocoon.configuration.PropertyHelper

public class PropertyHelper
extends Object

Helper class for replacing property references with the value of the property.

Since:
1.0
Version:
$Id: PropertyHelper.java 598033 2007-11-25 19:13:53Z giacomo $

Constructor Summary
PropertyHelper()
           
 
Method Summary
static String getProperty(String key, Properties properties, Settings settings)
          Return the value of the property.
static String replace(String value, Properties properties, Settings settings)
          Replace all property references in the string with the current value and return it.
static String replace(String value, Settings settings)
          Replace all property references in the string with the current value and return it.
static void replaceAll(Properties props, Settings settings)
          Replace all references in the values contained in the properties.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PropertyHelper

public PropertyHelper()
Method Detail

replace

public static String replace(String value,
                             Settings settings)
Replace all property references in the string with the current value and return it.


replace

public static String replace(String value,
                             Properties properties,
                             Settings settings)
Replace all property references in the string with the current value and return it.


getProperty

public static String getProperty(String key,
                                 Properties properties,
                                 Settings settings)
Return the value of the property. If a properties object is provided, this is searched first for a value. If no value is found and a settings object is provided, the settings object is searched for a value. If still no value is found, the system properties are searched. The key might contain a default value separated by a ':'! If no value is found and such a default value is provided, the default value is returned.

Parameters:
key - The key for the property.
properties - A set of properties.
settings - A settings object.
Returns:
Return the value or null.
Since:
1.0.1

replaceAll

public static void replaceAll(Properties props,
                              Settings settings)
Replace all references in the values contained in the properties. If the reference is not found in the properties it is searched in the settings.

Parameters:
props -
settings -


Copyright © 1999-2008 The Apache Software Foundation. All Rights Reserved.