niesfisch / tokenreplacer

Token Replacer is a simple and small Java Library that helps replacing tokens in strings. You can replace the tokens with static values or create values "on-the-fly" by calling a generator. You can even pass arguments to the generator which makes it pretty powerful.

Home Page:www.marcel-sauer.de

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

FR-2 Allow arbitrary (unknown) tokens to be replaced by callback

niesfisch opened this issue · comments

sometimes you have a string with tokens that are not known until runtime.

e.g.

some text with a ${token} and ${anotherOne} and ${anotherOne}.

as a developer i want to be able to register a callback which gets called for every token that is found.

so the callback would be called for

callback.replaceToken("token")
callback.replaceToken("anotherOne")
callback.replaceToken("anotherOne")

and so on

:)