public class CollectionHelper extends Object
Constructor and Description |
---|
CollectionHelper() |
Modifier and Type | Method and Description |
---|---|
static boolean |
getBooleanMapAttr(Map map,
String name,
boolean defaultValue)
Gets a boolean attribute from a
Map<String, Set<String>> , defaulting to the given default value if
the attribute is not present. |
static boolean |
getBooleanMapAttrThrows(Map map,
String name)
Gets a boolean attribute from a
Map<String, Set<String>> , throwing an exception if no boolean value (case
insensitive comparisons against "true" or "false") is found for the given key. |
static int |
getIntMapAttr(Map map,
String name,
int defaultValue,
Debug debug)
Returns integer value from a Map of String of Set of String.
|
static int |
getIntMapAttrThrows(Map map,
String name)
Returns integer value from a Map of String of Set of String.
|
static Map<Locale,String> |
getLocaleMapAttrThrows(Map<String,Set<String>> map,
String key)
The key we are given must refer to an entry in the Map which is a set of lines of the form:
en_GB|Here is some text in English fr_FR|Voici un texte en français All the text must fit onto one line. |
static long |
getLongMapAttr(Map<String,Set<String>> config,
String name,
long defaultValue,
Debug debug)
Returns a long value from the given configuration map.
|
static long |
getLongMapAttrThrows(Map<String,Set<String>> map,
String name)
Given the map attempts to return the named value as a long.
|
static String |
getMapAttr(Map<?,?> map,
String name)
Returns String from a map of string to set of string.
|
static String |
getMapAttr(Map map,
String name,
String defaultValue)
Returns String from a map of string of set of string.
|
static long |
getMapAttrAsDateLong(Map<String,Set<String>> config,
String name,
org.slf4j.Logger logger)
Returns the first attribute value for the corresponding name in the config map and parses it to a long.
|
static String |
getMapAttrThrows(Map map,
String key)
Return String from a map of strings to set of strings.
|
static Set<String> |
getMapSetThrows(Map<String,Set<String>> map,
String key)
Gets the set based on the passed key.
|
static String |
getServerMapAttr(Map map,
String attrName)
This convenience method is for getting server specific attributes from a
list attribute.
|
static Set<String> |
getServerMapAttrs(Map<String,Set<String>> map,
String attrName)
This convenience method is for getting server specific attributes from a
list attribute.
|
public static String getMapAttr(Map<?,?> map, String name)
map
- Map of string to set of string.name
- Key of the map entry.public static String getMapAttr(Map map, String name, String defaultValue)
map
- Map of string of set of string.name
- Key of the map entry.defaultValue
- Default value if the string is not found.public static String getMapAttrThrows(Map map, String key) throws ValueNotFoundException
map
- Map of string of set of string.name
- Key of the map entry.ValueNotFoundException
- if no value is found for the key.public static Set<String> getMapSetThrows(Map<String,Set<String>> map, String key) throws ValueNotFoundException
map
- the mapkey
- key to lookupValueNotFoundException
- should the key not existpublic static Map<Locale,String> getLocaleMapAttrThrows(Map<String,Set<String>> map, String key) throws ValueNotFoundException
Set
in an almost random order. Also if you specify the same locale on two or more
lines, only one can be added to the map (a random one due to the random order - although you will get a warning.
Caveat administrator.map
- The map of strings (keys) to sets of stringskey
- The key to use to access the mapValueNotFoundException
- if the set of values we need are not presentpublic static boolean getBooleanMapAttr(Map map, String name, boolean defaultValue)
Map<String, Set<String>>
, defaulting to the given default value if
the attribute is not present.map
- the attribute map.name
- the name of the attribute to retrieve.defaultValue
- the value to use if the attribute is not present.Boolean.parseBoolean(String)
.public static boolean getBooleanMapAttrThrows(Map map, String name) throws ValueNotFoundException
Map<String, Set<String>>
, throwing an exception if no boolean value (case
insensitive comparisons against "true" or "false") is found for the given key.map
- the attribute map.name
- the name of the attribute to retrieve.Boolean.parseBoolean(String)
.ValueNotFoundException
- if no boolean value is found for the given key.public static int getIntMapAttr(Map map, String name, int defaultValue, Debug debug)
map
- Map of String of Set of String.name
- Key of the map entry.defaultValue
- Default value if the integer value is not found.debug
- Debug object.public static int getIntMapAttrThrows(Map map, String name) throws ValueNotFoundException
map
- Map of String of Set of String.name
- Key of the map entry.ValueNotFoundException
- if there is no parsable value for the key provided.public static long getLongMapAttr(Map<String,Set<String>> config, String name, long defaultValue, Debug debug)
config
- the map of attribute values.name
- the attribute name to get.defaultValue
- the default value to use if the attribute is not set or is not a long.debug
- the debug object to report format errors to.public static long getLongMapAttrThrows(Map<String,Set<String>> map, String name) throws ValueNotFoundException
map
- the mapname
- the named valueValueNotFoundException
- should the value fail to parsepublic static long getMapAttrAsDateLong(Map<String,Set<String>> config, String name, org.slf4j.Logger logger)
config
- The map where the attribute should be retrieved from.name
- The name of the attribute that should be retrieved from the map.public static String getServerMapAttr(Map map, String attrName)
map
- Map of String of Set of String.attrName
- Key of the map entry of interest.public static Set<String> getServerMapAttrs(Map<String,Set<String>> map, String attrName)
map
- Map of String of Set of String.attrName
- Key of the map entry of interest.Copyright © 2010–2025 Open Identity Platform Community. All rights reserved.