|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.deegree.commons.utils.kvp.KVPUtils
public class KVPUtils
This class contains convenience methods for working with key-value pair maps (e.g. from OGC KVP requests).
Constructor Summary | |
---|---|
KVPUtils()
|
Method Summary | |
---|---|
static BigInteger |
getBigInt(Map<String,String> kvpParams,
String paramName,
BigInteger defaultValue)
Returns the specified parameter from a KVP map as a BigInteger value. |
static boolean |
getBoolean(Map<String,String> kvpParams,
String paramName,
boolean defaultValue)
Returns the specified parameter from a KVP map as a boolean value. |
static String |
getDefault(Map<String,String> param,
String key,
String defaultValue)
Returns the value of the key or the default value if the kvp map doesn't contain the key. |
static double |
getDefaultDouble(Map<String,String> param,
String key,
double defaultValue)
|
static int |
getInt(Map<String,String> kvpParams,
String paramName,
int defaultValue)
Returns the specified parameter from a KVP map as an integer value. |
static Map<String,String> |
getNormalizedKVPMap(String queryString,
String encoding)
|
static String |
getRequired(Map<String,String> param,
String key)
Returns the value of the key. |
static double |
getRequiredDouble(Map<String,String> param,
String key)
|
static int |
getRequiredInt(Map<String,String> param,
String key)
|
static Map<String,String> |
readFileIntoMap(URL url)
Reads a text file with KVP content into a map. |
static List<String> |
splitAll(Map<String,String> param,
String key)
Return a list with all values for a key. |
static String[] |
splitList(String param)
|
static List<String> |
splitLists(String s)
Splits a parameter list thats encoded according to ISO 19143, 5.5 |
static String |
toQueryString(Map<String,String> map)
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public KVPUtils()
Method Detail |
---|
public static String getRequired(Map<String,String> param, String key) throws MissingParameterException
param
- the key-value mapkey
-
MissingParameterException
- if the kvp map doesn't contain the keypublic static int getRequiredInt(Map<String,String> param, String key) throws MissingParameterException, InvalidParameterValueException
param
- key
-
MissingParameterException
- if the kvp map doesn't contain the key
InvalidParameterValueException
- if the value is not an integerpublic static double getRequiredDouble(Map<String,String> param, String key) throws MissingParameterException, InvalidParameterValueException
param
- key
-
MissingParameterException
- if the kvp map doesn't contain the key
InvalidParameterValueException
- if the value is not a doublepublic static double getDefaultDouble(Map<String,String> param, String key, double defaultValue)
param
- key
- defaultValue
- to be used if missing.
public static List<String> splitLists(String s)
s
-
public static String[] splitList(String param)
public static String getDefault(Map<String,String> param, String key, String defaultValue)
param
- the key-value mapkey
- defaultValue
-
public static List<String> splitAll(Map<String,String> param, String key)
param
- the key-value mapkey
-
public static boolean getBoolean(Map<String,String> kvpParams, String paramName, boolean defaultValue) throws InvalidParameterValueException
kvpParams
- KVP mapparamName
- name of the parameterdefaultValue
- returned when the specified parameter is not present in the map (=null)
InvalidParameterValueException
- if the parameter value is neither null nor "true" nor "false"public static int getInt(Map<String,String> kvpParams, String paramName, int defaultValue) throws InvalidParameterValueException
kvpParams
- KVP mapparamName
- name of the parameterdefaultValue
- returned when the specified parameter is not present in the map (=null)
InvalidParameterValueException
- if the parameter value does not denote an integerpublic static BigInteger getBigInt(Map<String,String> kvpParams, String paramName, BigInteger defaultValue) throws InvalidParameterValueException
BigInteger
value.
kvpParams
- KVP mapparamName
- name of the parameterdefaultValue
- returned when the specified parameter is not present in the map (=null)
InvalidParameterValueException
- if the parameter value does not denote an integerpublic static Map<String,String> readFileIntoMap(URL url) throws IOException
Example contents:
SERVICE=WFS VERSION=1.1.0 REQUEST=DescribeFeatureType TYPENAME=TreesA_1MWhat this method does:
url
- url of the text file
IOException
- if the the file cannot be loadedpublic static Map<String,String> getNormalizedKVPMap(String queryString, String encoding) throws UnsupportedEncodingException
queryString
- encoding
- used for decoding the URL-decoded characters, may be null
(turns on guessing, don't do
it)
UnsupportedEncodingException
public static String toQueryString(Map<String,String> map)
map
-
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |