Package de.eacg.ecs.client
Class JsonProperties
- All Implemented Interfaces:
Serializable,Cloneable,Map<Object,Object>
Simple
java.util.Properties implementation, that is able to parse a properties file in json format.
Restrictions: supported types: String and (nested) Object ; other types in json file are ignored.
Nested objects key names are separated by '.'
Example:
{ "name": {"firstName": "Bart", "lastName": "Simpson"}}
produces the properties:
name.firstName = "Bart"
name.lastName = "Simpson"
Additional features:
- an additional 'defaults' properties list, my by provided in the constructors.
- defaults for the manadatory properties required by the RestClient may also be set by named setters (e.g. setUserName())
- a validate method checks if all required properties for RestClient are available- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final StringFields inherited from class java.util.Properties
defaults -
Constructor Summary
ConstructorsConstructorDescriptionJsonProperties(InputStream is, Properties defaults) JsonProperties(String filename) JsonProperties(String filename, Properties defaults) -
Method Summary
Modifier and TypeMethodDescriptionvoidvoidsetApiPath(String apiPath) voidsetBaseUrl(String baseUrl) voidsetProxyPass(String proxyPass) voidsetProxyPort(String proxyPort) voidsetProxyUrl(String proxyUrl) voidsetProxyUser(String proxyUser) check if minimum required parameters are set: "userName", "apiKey", "baseUrl", "apiPath"Methods inherited from class java.util.Properties
clear, clone, compute, computeIfAbsent, computeIfPresent, contains, containsKey, containsValue, elements, entrySet, equals, forEach, get, getOrDefault, getProperty, getProperty, hashCode, isEmpty, keys, keySet, list, list, load, load, loadFromXML, merge, propertyNames, put, putAll, putIfAbsent, rehash, remove, remove, replace, replace, replaceAll, save, setProperty, size, store, store, storeToXML, storeToXML, storeToXML, stringPropertyNames, toString, values
-
Field Details
-
API_KEY
- See Also:
-
BASE_URL
- See Also:
-
API_PATH
- See Also:
-
PROXY_URL
- See Also:
-
PROXY_PORT
- See Also:
-
PROXY_USER
- See Also:
-
PROXY_PASS
- See Also:
-
-
Constructor Details
-
JsonProperties
- Throws:
IOException
-
JsonProperties
- Throws:
IOException
-
JsonProperties
- Throws:
IOException
-
JsonProperties
- Throws:
IOException
-
-
Method Details
-
setApiKey
-
setBaseUrl
-
setApiPath
-
setProxyUrl
-
setProxyPort
-
setProxyUser
-
setProxyPass
-
validate
check if minimum required parameters are set: "userName", "apiKey", "baseUrl", "apiPath"- Parameters:
keys- additional keys to check- Returns:
- a list of missing keys
-