public class Env extends Object
| Constructor and Description |
|---|
Env()
Construct an Env instance with the current system environment
|
| Modifier and Type | Method and Description |
|---|---|
int |
getInt(String key)
Get the value of an environment variable as an integer
|
int |
getInt(String key,
int defaultValue)
Get the value of an environment variable as an integer, or a default value if it does not exist
|
String |
getString(String key)
Get the value of an environment variable as a string
|
String |
getString(String key,
String defaultValue)
Get the value of an environment variable as a string, or a default value if it does not exist
|
public String getString(@NonNull String key)
key - the environment variableIllegalArgumentException - if the environment variable does not existpublic String getString(@NonNull String key, String defaultValue)
key - the environment variabledefaultValue - the value to use if the environment variable does not existpublic int getInt(@NonNull
String key)
key - the environment variableIllegalArgumentException - if the environment variable does not existNumberFormatException - if the value cannot be parsed as an integerpublic int getInt(@NonNull
String key,
int defaultValue)
key - the environment variabledefaultValue - the value to use if the environment variable does not existNumberFormatException - if the value cannot be parsed as an integerCopyright © 2017. All rights reserved.