public final class ConfigParser extends Object
Modifier and Type | Class and Description |
---|---|
static class |
ConfigParser.ConfigParserException
A custom exception that represents all problems arising out of parsing configurations via
ConfigParser |
Modifier and Type | Method and Description |
---|---|
int |
getInt(String key) |
int |
getInt(String key,
int defaultVal) |
com.google.gson.JsonObject |
getJsonObject(String key) |
com.google.gson.JsonObject |
getJsonObject(String key,
com.google.gson.JsonObject defaultVal) |
long |
getLong(String key) |
long |
getLong(String key,
long defaultVal) |
String |
getString(String key) |
String |
getString(String key,
String defaultVal) |
static ConfigParser |
parse() |
static ConfigParser |
setConfigFile(String file)
Set the config file
|
String |
toString() |
public static ConfigParser parse()
ConfigParser
object that can be used to retrieve values from the Configuration object as
represented by the JSON file passed via the JVM argument SeLionConfigpublic static ConfigParser setConfigFile(String file)
file
- the SeLion Grid config file to usepublic int getInt(String key)
key
- The key for which the value is to be read for.public int getInt(String key, int defaultVal)
key
- The key for which the value is to be read for.defaultVal
- default value to use if the key does not exist or has an malformed value.public long getLong(String key)
key
- The key for which the value is to be read for.public long getLong(String key, long defaultVal)
key
- The key for which the value is to be read for.defaultVal
- default value to use if the key does not exist or has an malformed value.public String getString(String key)
key
- The key for which the value is to be read for.public String getString(String key, String defaultVal)
key
- The key for which the value is to be read for.defaultVal
- default value to use if the key does not exist or has an malformed value.public com.google.gson.JsonObject getJsonObject(String key)
key
- The key for which the value is to be read for.JsonObject
that represents the value for the key.public com.google.gson.JsonObject getJsonObject(String key, com.google.gson.JsonObject defaultVal)
key
- The key for which the value is to be read for.defaultVal
- default value to use if the key does not exist or has an malformed value.JsonObject
that represents the value for the key or the defaultVal if no such key exists.Copyright © 2016 PayPal Open Source. All rights reserved.