org.ploin.pmf.impl
Class MailReplacer

java.lang.Object
  extended by org.ploin.pmf.impl.MailReplacer
All Implemented Interfaces:
Serializable, IMailReplacer

public class MailReplacer
extends Object
implements Serializable, IMailReplacer

Description: Implementation of the IMailReplacer interface.
This class offers a method to replace all string-snippets which are matching the keys of the replaceMap.

$LastChangedBy: j.schwarz $
$Revision: 76 $
$Date: 2010-03-04 14:45:28 +0100 (Thu, 04 Mar 2010) $

See Also:
Serialized Form

Constructor Summary
MailReplacer()
           
 
Method Summary
 String replace(String templateText, Map<String,String> replaceMap)
          Every occurence of each key in the templateText is replaced by the corresponding value.

There are two "kinds" of keys you can use:
* Keys of the (old) form ":key" will trigger the replacement of all occurences of ":key" in the templateText.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MailReplacer

public MailReplacer()
Method Detail

replace

public String replace(String templateText,
                      Map<String,String> replaceMap)
               throws MailFactoryException
Every occurence of each key in the templateText is replaced by the corresponding value.

There are two "kinds" of keys you can use:
* Keys of the (old) form ":key" will trigger the replacement of all occurences of ":key" in the templateText.
* Keys without starting ":" like "key" will trigger the replacement of all occurences of "#{key}" in the templateText.

Specified by:
replace in interface IMailReplacer
Parameters:
templateText - - the email-template
replaceMap - - the given map by the user
Returns:
a new email-text
Throws:
MailFactoryException


Copyright © 2012 PLOIN GmbH. All Rights Reserved.