org.apache.commons.scaffold.text
Class Merge

java.lang.Object
  extended by org.apache.commons.scaffold.text.Merge

public class Merge
extends Object

Merge utilities.

Version:
$Revision: 155464 $ $Date: 2005-02-26 13:26:54 +0000 (Sat, 26 Feb 2005) $
Author:
Ted Husted

Field Summary
static String TOKEN_PREFIX
          The token markers for replacement variables, i.e.
static String TOKEN_SUFFIX
           
 
Constructor Summary
Merge()
           
 
Method Summary
static int keys(StringBuffer content, Map tokens)
          Merge a Map of tokens with a template in a StringBuffer.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

TOKEN_PREFIX

public static String TOKEN_PREFIX
The token markers for replacement variables, i.e. ${a1}


TOKEN_SUFFIX

public static String TOKEN_SUFFIX
Constructor Detail

Merge

public Merge()
Method Detail

keys

public static int keys(StringBuffer content,
                       Map tokens)
Merge a Map of tokens with a template in a StringBuffer. The parameters are marked by ${key} where (String) Map.get(key)!=null. The merged content is returned in the same StringBuffer. Tokens cannot be nested. Unmatched tokens are ignored.

Parameters:
content - The text containing merge tokens to be replaced.
Returns:
int Number of replacements made


Copyright © 2001-2010 The Apache Software Foundation. All Rights Reserved.