Class TokenResolver
- java.lang.Object
-
- com.sun.enterprise.universal.glassfish.TokenResolver
-
public class TokenResolver extends Object
Here is the contract: You give me a Mapobject. Then you can call resolve(List ) and/or resolve(String) and/or resolve(Map ) 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... - Since:
- April 20, 2007
- Version:
- 3
- Author:
- bnevins
-
-
Constructor Summary
Constructors Constructor Description TokenResolver()
Empty constructor means use System PropertiesTokenResolver(Map<String,String> map)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static boolean
hasToken(String s)
String
resolve(String s)
Replace $[variables} with a matching property in the mapvoid
resolve(List<String> list)
Replace $[variables} in list with a matching property from the mapvoid
resolve(Map<String,String> map)
Replace $[variables} in map with a matching property from the map that this instance was constructed with.
-
-
-
Method Detail
-
resolve
public void resolve(Map<String,String> map)
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
public void resolve(List<String> list)
Replace $[variables} in list with a matching property from the map- Parameters:
list
- List of Strings to be token-replaced
-
resolve
public String resolve(String s)
Replace $[variables} with a matching property in the map- Parameters:
s
- String to be token-replaced- Returns:
- the replaced String
-
hasToken
public static boolean hasToken(String s)
-
-