public class EnvarBasedValueSource extends AbstractValueSource
ValueSource
which resolves expressions against the environment variables
available from the underlying operating system (and possibly, the shell environment
that created the present Java process). If the expression starts with 'env.',
this prefix is trimmed before resolving the rest as an environment variable name.Modifier and Type | Field and Description |
---|---|
private boolean |
caseSensitive |
private java.util.Properties |
envars |
private static java.util.Properties |
envarsCaseInsensitive |
private static java.util.Properties |
envarsCaseSensitive |
Constructor and Description |
---|
EnvarBasedValueSource()
Create a new value source for interpolation based on shell environment variables.
|
EnvarBasedValueSource(boolean caseSensitive)
Create a new value source for interpolation based on shell environment variables.
|
Modifier and Type | Method and Description |
---|---|
private static java.util.Properties |
getEnvars(boolean caseSensitive) |
java.lang.Object |
getValue(java.lang.String expression)
If the expression starts with 'env.' then trim this prefix.
|
(package private) static void |
resetStatics()
reset static variables acting as a cache for testing purposes only
|
addFeedback, addFeedback, clearFeedback, getFeedback
private static java.util.Properties envarsCaseSensitive
private static java.util.Properties envarsCaseInsensitive
private final java.util.Properties envars
private final boolean caseSensitive
public EnvarBasedValueSource() throws java.io.IOException
java.io.IOException
- in case of an error.public EnvarBasedValueSource(boolean caseSensitive) throws java.io.IOException
caseSensitive
- Whether the environment variable key should be treated in a
case-sensitive manner for lookupsjava.io.IOException
- in case of an error.private static java.util.Properties getEnvars(boolean caseSensitive) throws java.io.IOException
java.io.IOException
public java.lang.Object getValue(java.lang.String expression)
ValueSource
instance was created.expression
- envar expression, like 'HOME' or 'env.HOME'static void resetStatics()