Class MapValueParser
- java.lang.Object
-
- com.sun.identity.common.configuration.MapValueParser
-
public class MapValueParser extends Object
Parse values out of a map (strings, basically), which come to us in the form: [google]=AuthChainSocialGoogle [twitter]=AuthChainSocialTwitter [flickr]=AuthChainSocialFlickr and break these into Pair objects containing: (google,AuthChainSocialGoogle) (twitter,AuthChainSocialTwitter) (flickr,AuthChainSocialTwitter) Note that the regular expressions are COPIED from MapValueValidator. I would liked to have used the ones defined there, but they were not quite what I needed (I have added two groups). I considered: - using the original values and altering them in code here - altering the originals (by adding two groups, I don't think I would change any behaviour, but I can't be sure) anyway, I thought the first too extreme and the second too dangerous
-
-
Constructor Summary
Constructors Constructor Description MapValueParser()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description String
getValueForName(String name, Set<String> entries)
The incoming set of strings contains the [name]=value pairs.org.forgerock.util.Pair<String,String>
parse(String entry)
Pass in a single string of the form "[name]=value" to this function and get back a Pair object, containing the name and value (split out into members of the Pair).Map<String,String>
parse(Set<String> entries)
Pass in a set of name=value pairs to this function and get back a hashmap of values, keyed by name.
-
-
-
Method Detail
-
parse
public Map<String,String> parse(Set<String> entries)
Pass in a set of name=value pairs to this function and get back a hashmap of values, keyed by name.- Parameters:
entries
- The set of strings- Returns:
- a hashmap of values, keyed by name
-
parse
public org.forgerock.util.Pair<String,String> parse(String entry)
Pass in a single string of the form "[name]=value" to this function and get back a Pair object, containing the name and value (split out into members of the Pair).- Parameters:
entry
- a single [name]=value pair- Returns:
- a Pair object containing "name" and "value" strings as members of the Pair, or null if there was no match, or if either name or value are null. Note that both "name" and "value" are trimmed.
-
getValueForName
public String getValueForName(String name, Set<String> entries)
The incoming set of strings contains the [name]=value pairs. Search for the entry containing the name specified and return the corresponding value, or null if "name" was not found.- Parameters:
name
- The name to search forentries
- The entries to search in- Returns:
- the value if found, or null if not
-
-