org.milyn.util
Class DollarBraceDecoder

java.lang.Object
  extended by org.milyn.util.DollarBraceDecoder

public class DollarBraceDecoder
extends Object

Decoder for Strings containing "${xxxxx}" type patterns.

Author:
tom.fennelly@gmail.com

Field Summary
static String PATTERN
          Match against "${}", where there's at least one of any character except '}' in between the braces ("{}").
 
Constructor Summary
DollarBraceDecoder()
           
 
Method Summary
static List<String> getTokens(String string)
          Get the ${} tokens from the supplied string.
static String replaceTokens(String string, String replacement)
          Replace all the ${} tokens with the specified String.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

PATTERN

public static final String PATTERN
Match against "${}", where there's at least one of any character except '}' in between the braces ("{}").

See Also:
Constant Field Values
Constructor Detail

DollarBraceDecoder

public DollarBraceDecoder()
Method Detail

getTokens

public static List<String> getTokens(String string)
Get the ${} tokens from the supplied string.

For example, if the input string is "xxxx ${A} xxxxx ${B} ...", this method will return a List containing 2 String, "A" and "B".

Parameters:
string - The String from which to extract the ${} tokens.
Returns:
The list of tokens.

replaceTokens

public static String replaceTokens(String string,
                                   String replacement)
Replace all the ${} tokens with the specified String.

For example, if the input string is "xxxx ${A} xxxxx ${B} ..." and the replacement String "?", this method will return "xxxx ? xxxxx ? ...".

Parameters:
string - The String on which to perform the replacement.
replacement - The replacement string.
Returns:
The String with the tokens replaced.


Copyright © 2018. All rights reserved.