|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
public interface TokenReplacer
Toky| Method Summary | |
|---|---|
TokenReplacer |
disableGeneratorCaching()
turns generator caching OFF. |
TokenReplacer |
doNotIgnoreMissingValues()
tells the TokenReplacer to report any tokens that can not be
replaced. |
TokenReplacer |
enableGeneratorCaching()
turns generator caching ON. |
TokenReplacer |
ignoreMissingValues()
tells the TokenReplacer to IGNORE any tokens that can not be
replaced. |
TokenReplacer |
register(java.lang.String[] replacements)
registers an array of replacements for a string based in indexed tokens. |
TokenReplacer |
register(java.lang.String token,
Generator Generator)
registers a Token that will be replaced by the given
Generator. |
TokenReplacer |
register(java.lang.String token,
java.lang.String value)
registers a static value for a given token. |
TokenReplacer |
register(Token token)
registers a Token that needs to be replaced. |
java.lang.String |
substitute(java.lang.String toSubstitute)
replaces all Token with one of the following:
the provided static values set via register(String, String)
the token registered via register(Token)
the generator registered via register(String, Generator)
|
TokenReplacer |
withArgumentDelimiter(java.lang.String argsSep)
|
TokenReplacer |
withArgumentEnd(java.lang.String argsEnd)
|
TokenReplacer |
withArgumentStart(java.lang.String argsStart)
|
TokenReplacer |
withTokenEnd(java.lang.String tokenEnd)
|
TokenReplacer |
withTokenStart(java.lang.String tokenStart)
|
| Method Detail |
|---|
java.lang.String substitute(java.lang.String toSubstitute)
Token with one of the following:
register(String, String)
register(Token)
register(String, Generator)
toSubstitute - the string that contains the tokens, will be returned as-is in
case of null or empty string
ParseException - when the internal state is incorrect and error reporting was
turned on via doNotIgnoreMissingValues()
NoValueOrGeneratorFoundException - when no explicit value or Generator was found for the token and
we don't ignore errors via doNotIgnoreMissingValues()
TokenReplacer register(java.lang.String token,
java.lang.String value)
#register(Generator). same as registering a token via
register(Token) and supplying a replacement value via
Token.replacedBy(String).
token - the name of the token to be replaced e.g. for ${date} ->
"date" would be the token, must not be null or emptyvalue - the static value that will be used when replacing the token,
must not be null or empty
TokenReplacer to allow method chainingTokenReplacer register(Token token)
Token that needs to be replaced.
token - the Token, must not be null, the token must have a
valid value or generator associated with it which was set via
Token.replacedBy(String) or
Token.replacedBy(String)
#TokenReplacer to allow method chaining
TokenReplacer register(java.lang.String token,
Generator Generator)
Token that will be replaced by the given
Generator. same as registering a token via
register(Token) and supplying a generator via
Token.replacedBy(Generator)
token - the name of the token to be replaced e.g. for ${date} ->
"date" would be the token, must not be null or emptygenerator - the #Generator to use when replacing the value, must
not be null or empty
#TokenReplacer to allow method chainingTokenReplacer register(java.lang.String[] replacements)
toky.register(new String[] { "one", "two", "three" });
toky.substitute("{0} {1} {2}")); // will result in "one two three"
replacements - the array of replacements that will be used when replacing an
indexed strings, must not be null but can be empty
#TokenReplacer to allow method chainingTokenReplacer withTokenStart(java.lang.String tokenStart)
tokenStart - sets the token start identifier to the given value e.g.
[dynamic] -> '[' would be the start identifier, e.g. '[', must
not be null or empty
#TokenReplacer to allow method chainingTokenReplacer withTokenEnd(java.lang.String tokenEnd)
tokenEnd - sets the token end identifier to the given value e.g.
[dynamic] -> ']' would be the end identifier, e.g. '[', must
not be null or empty
#TokenReplacer to allow method chainingTokenReplacer withArgumentDelimiter(java.lang.String argsSep)
argsSep - changes the delimiter of the arguments to the given value e.g.
{dynamic(1;2;3)} -> ';' would be the delimiter, must not be
null or empty
#TokenReplacer to allow method chainingTokenReplacer withArgumentStart(java.lang.String argsStart)
argsStart - sets the argument start identifier to the given value e.g.
{dynamic[1;2;3]} -> '[' would be the delimiter e.g. '[', must
not be null or empty
#TokenReplacer to allow method chainingTokenReplacer withArgumentEnd(java.lang.String argsEnd)
argsEnd - sets the argument end identifier to the given value e.g.
{dynamic[1;2;3]} -> ']' would be the delimiter e.g. ']', must
not be null or empty
#TokenReplacer to allow method chainingTokenReplacer doNotIgnoreMissingValues()
TokenReplacer to report any tokens that can not be
replaced. if turned on an IllegalStateException will be thrown
during token replacement. reporting errors is turned ON by DEFAULT.
#TokenReplacer to allow method chainingTokenReplacer ignoreMissingValues()
TokenReplacer to IGNORE any tokens that can not be
replaced. if turned OFF no Exceptions will be thrown during token
replacement. reporting errors is turned ON by DEFAULT.
#TokenReplacer to allow method chainingTokenReplacer enableGeneratorCaching()
Generator all remaining values with the same token name will be
replaced by the cached version. use disableGeneratorCaching() to
turn caching off.
#TokenReplacer to allow method chainingTokenReplacer disableGeneratorCaching()
enableGeneratorCaching() to
turn caching on.
#TokenReplacer to allow method chaining
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||