read
Reads an environment variable and converts it to the specified type.
This method supports the following types:
- String
- Integer and
int - Short and
short - Long and
long - Float and
float - Double and
double - Character and
char - Boolean and
boolean(parses "true" and "false", case-insensitive)
Return
an Optional containing the value of the environment variable, or empty if the variable is not set
Parameters
key
the name of the environment variable
targetType
the type to convert the value to
Throws
if the target type is not supported