com.cafesoft.core.util
Class NamespaceMapUtils

java.lang.Object
  extended by com.cafesoft.core.util.NamespaceMapUtils

public class NamespaceMapUtils
extends Object

NamespaceMapUtils provides utility methods related to use of NamespaceMap implementations.

Since:
04/02/2009

Field Summary
static boolean debug
          Global debug flag.
 
Constructor Summary
NamespaceMapUtils()
           
 
Method Summary
static String replaceTokens(String source, NamespaceMap nsMap, TokenDelimiterSpec tds)
          Replace tokens in source String with values from a NamespaceMap.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

debug

public static boolean debug
Global debug flag. Enable debug to System.err.

Constructor Detail

NamespaceMapUtils

public NamespaceMapUtils()
Method Detail

replaceTokens

public static String replaceTokens(String source,
                                   NamespaceMap nsMap,
                                   TokenDelimiterSpec tds)
Replace tokens in source String with values from a NamespaceMap.

For example, if string is: value1,value2,value3 and the delimiter is ',', then return an array of 3 Strings.

Parameters:
source - the source String containing tokens to be parsed and replaced.
nsMap - the NamespaceMap containing the values that will replace tokens.
tds - the TokenDelmiterSpec that provides information on the syntax of tokens, including the delmiters for start, end, and namespace.
Returns:
a new String with tokens replace by values from the NamespaceMap. If the source string does not contain any tokens, the original String is returned. If the source String contains tokens that cannot be resolved, the tokens are replaced by an empty string. NOTE: if unresolved tokens are an error, then use method: replaceTokens2
Throws:
NullPointerException - if the NamespaceMap or TokenDelimiterSpec are null.


Generated on 10:38:35 AM April 14, 2011, © 1996-2010 Cafésoft LLC. All rights reserved.