com.agimatec.commons.util
Class PropertyReplacer

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

public class PropertyReplacer
extends 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(Map aProperties)
           
 
Method Summary
 Map getProperties()
           
 String replaceProperties(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.

 String replaceProperties(String value, 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(Map aProperties)
Method Detail

getProperties

public Map getProperties()

replaceProperties

public String replaceProperties(String value,
                                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 String replaceProperties(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.