Class TokenResolver
java.lang.Object
com.sun.enterprise.universal.glassfish.TokenResolver
Here is the contract:
You give me a Map<String,String> object.
Then you can call resolve(List) and/or resolve(String) and/or
resolve(Map<String,String>)
I will find and replace the tokens, e.g., ${foo} with the value of "foo" in the properties.
If the token has no such property -- then I leave the token as is.
It purposely does not handle nested tokens. E.g. if the "foo" property has another
token embedded in the value -- it will not be further resolved.
This is the KISS principle in action...
- Author:
- bnevins
-
Constructor Summary
ConstructorsConstructorDescriptionEmpty constructor means use System PropertiesTokenResolver(Map<String, String> map) -
Method Summary
Modifier and TypeMethodDescriptionstatic booleanReplace $[variables} with a matching property in the mapvoidReplace $[variables} in list with a matching property from the mapvoidReplace $[variables} in map with a matching property from the map that this instance was constructed with.
-
Constructor Details
-
TokenResolver
public TokenResolver()Empty constructor means use System Properties -
TokenResolver
-
-
Method Details
-
resolve
Replace $[variables} in map with a matching property from the map that this instance was constructed with. Both names and values are replaced.- Parameters:
map- Map of Strings to be token-replaced
-
resolve
Replace $[variables} in list with a matching property from the map- Parameters:
list- List of Strings to be token-replaced
-
resolve
Replace $[variables} with a matching property in the map- Parameters:
s- String to be token-replaced- Returns:
- the replaced String
-
hasToken
-