org.jboss.maven.shared.properties
Class PropertiesHelper

java.lang.Object
  extended by org.jboss.maven.shared.properties.PropertiesHelper

public class PropertiesHelper
extends java.lang.Object

Utilities for dealing with @{link Properties} objects.

Taken from maven-war-plugin, which apparently took it from maven-resources-plugin... ;)

Author:
Steve Ebersole

Method Summary
static java.lang.String getInterpolatedPropertyValue(java.lang.String key, java.util.Properties props)
          Retrieves a property value, replacing values like ${token} using the Properties to look them up.
static java.util.Properties loadPropertyFile(java.io.File propfile)
          Reads a property file, resolving all internal variables.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

loadPropertyFile

public static java.util.Properties loadPropertyFile(java.io.File propfile)
Reads a property file, resolving all internal variables.

Parameters:
propfile - The property file to load
Returns:
the loaded and fully resolved Properties object

getInterpolatedPropertyValue

public static java.lang.String getInterpolatedPropertyValue(java.lang.String key,
                                                            java.util.Properties props)
Retrieves a property value, replacing values like ${token} using the Properties to look them up.

It will leave unresolved properties alone, trying for System properties, and implements reparsing (in the case that the value of a property contains a key), and will not loop endlessly on a pair like test = ${test}.

Parameters:
key - The key for which to find the corresponding value
props - The properties from which to find the value.
Returns:
The (possible interpolated) property value


Copyright © 2007-2008 JBoss, a division of Red Hat, Inc. All Rights Reserved.