com.agimatec.commons.util
Class PropertyReplacer

java.lang.Object
  extended by com.agimatec.commons.util.PropertyReplacer

public class PropertyReplacer
extends java.lang.Object

Title: Agimatec GmbH

Description: Class to replace ${property} properties by a value in a Map. Idea and code based on Jakarta ANT's ProjectHelper.java.

Company: Agimatec GmbH

Author:
Roman Stumm

Constructor Summary
PropertyReplacer(java.util.Map aProperties)
           
 
Method Summary
 java.util.Map getProperties()
           
 java.lang.String replaceProperties(java.lang.String value)
          Source based on ant's tools.ant.ProjectHelper.java

Replace ${} style constructions in the given value with the string value of the corresponding data types.

 java.lang.String replaceProperties(java.lang.String value, java.lang.String chars)
          Replace in a simple style with flexible separator chars, e.g.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PropertyReplacer

public PropertyReplacer(java.util.Map aProperties)
Method Detail

getProperties

public java.util.Map getProperties()

replaceProperties

public java.lang.String replaceProperties(java.lang.String value,
                                          java.lang.String chars)
Replace in a simple style with flexible separator chars, e.g. [name] or {name} or (name}. (Note: the double beginChar is replace by a single beginChar)

Parameters:
value - - string to replace properties in
chars - - a two-char string with begin+end char, default (if null) = "{}"

replaceProperties

public java.lang.String replaceProperties(java.lang.String value)
Source based on ant's tools.ant.ProjectHelper.java

Replace ${} style constructions in the given value with the string value of the corresponding data types.

Parameters:
value - the string to be scanned for property references.
Returns:
the string with properties replaced by their value


Copyright © 2008-2012. All Rights Reserved.