public final class ReplacedStringsDecoder extends Object
Modifier and Type | Field and Description |
---|---|
static String |
ARGUMENT_PLACE_HOLDER |
static ReplacedStringsDecoder |
NULL_DECODER
A null decoder that does no mapping.
|
Constructor and Description |
---|
ReplacedStringsDecoder(VariableMap variableMap) |
Modifier and Type | Method and Description |
---|---|
String |
decode(String encodedStr)
Decodes an encoded string from the JS Compiler ReplaceStrings pass.
|
public static final String ARGUMENT_PLACE_HOLDER
public static final ReplacedStringsDecoder NULL_DECODER
public ReplacedStringsDecoder(VariableMap variableMap)
public String decode(String encodedStr)
An original string with args might look like this:
Error('Some ' + arg1 + ' error ' + arg2 + ' message.');Which gets replaced with:
Error('key' + '`' + arg1 + '`' + arg2);Where ` is the argument place holder. The replacement mapping would be:
key → 'Some ` error ` message.'Where key is some arbitrary replacement string. An encoded string, with args, from the client will look like:
'key`arg1`arg2'
encodedStr
- An encoded string.ReplaceStrings
Copyright © 2009-2016 Google. All Rights Reserved.