|
deegree-core-3.0-pre-nightly (2010/03/05 00:01) - official | |||||||||
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 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 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. |
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 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 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 loaded
|
deegree-core-3.0-pre-nightly (2010/03/05 00:01) - official | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |