net.sf.hermesftp.utils
Class VarMerger

java.lang.Object
  extended by net.sf.hermesftp.utils.VarMerger

public class VarMerger
extends java.lang.Object

Replaces all placeholders in a given text document with the values of a properties-Object. Example: The text "Hello ${name}" becomes "Hello world" provided that passed properties object contains the entry name=world.

VarMerger vm = new VarMerger("The ${dog} chases the ${cat}"); Properties p = new Properties(); p.put("dog", "fox"); p.put("cat", "mouse"); vm.merge(p); String neuerSatz = vm.getText();

Author:
Lars Behnke

Constructor Summary
VarMerger(java.lang.String text)
           
 
Method Summary
 java.lang.String getText()
           
 boolean isReplacementComplete()
          Pr�ft, ob der Text noch Platzhalter enth�lt, die noch nicht ersetzt wurden.
 void merge(java.util.Properties props)
          Replaces the placeholders with the passed values.
 void setText(java.lang.String text)
          Sets the text containing placeholders.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

VarMerger

public VarMerger(java.lang.String text)
Parameters:
text - Der Text containing placeholders.
Method Detail

merge

public void merge(java.util.Properties props)
Replaces the placeholders with the passed values.

Parameters:
props - The values.

setText

public void setText(java.lang.String text)
Sets the text containing placeholders.

Parameters:
text - The text.

getText

public java.lang.String getText()
Returns:
Der Text mit den ersetzten Platzhaltern.

isReplacementComplete

public boolean isReplacementComplete()
Pr�ft, ob der Text noch Platzhalter enth�lt, die noch nicht ersetzt wurden.

Returns:
True, falls der Text keine Platzhalter mehr enth�lt.


Copyright © 2005-2007 Lars Behnke. All Rights Reserved.