public interface LoaderEnvironment
Loaders when they load values.
Some of the places Loaders load values from are one-of-a-kind / unique resources, such as system properties, environment variables, command line arguments, etc.. Rather than inject each loader with it's needed resources, the LoaderEnvironment makes them available to all loaders. This interface also simplifies testing by providing a central place to set the environment Loaders will see.
Note that there are two, parallel 'fixedValue' systems: name and Property. These are two equally valid ways to set a fixed value, but they cannot be reconciled until the AndHow initialization is complete to resolve names.
| Modifier and Type | Method and Description |
|---|---|
List<String> |
getCmdLineArgs()
Returns the command line argument strings passed to the
main(String[] args) method,
as a List, if they are available. |
Map<String,String> |
getEnvVars()
Returns a string map view of the current system environment variables.
|
Map<String,Object> |
getFixedNamedValues()
Returns a Map of hard-coded / fixed values for some properties referenced by name and set by
application code prior to AndHow initialization.
|
List<PropertyValue<?>> |
getFixedPropertyValues()
Returns a List of hard-coded / fixed values for some properties in the form of a List of
PropertyValues, set application code prior to AndHow initialization. |
JndiContextWrapper |
getJndiContext()
Returns a JNDI Context that can be used by loaders to load from JNDI.
|
Map<String,String> |
getSysProps()
Returns a snapshot of current system properties.
|
Map<String,String> getEnvVars()
Nominally the same as System.getenv(), but may be customized for testing.
Map<String,String> getSysProps()
Nominally the same as System.getProperties(), but may be customized for testing.
List<String> getCmdLineArgs()
main(String[] args) method,
as a List, if they are available.
Its possible that cmd line arguments are passed to the application but not available here.
This is because AndHow has no way to intercept cmd line arguments, so application code needs
to pass them in to AndHow, which may not have been done
(See how-to details in StdMainStringArgsLoader).
Nominally this returns the same as the cmd line arguments converted to a List, but may be customized for testing.
Map<String,Object> getFixedNamedValues()
The referenced Properties and values returned by this method and getFixedPropertyValues()
are intended to be loaded by the StdFixedValueLoader, which nominally loads prior to any
other loader, effectively making the value non-configurable.
List<PropertyValue<?>> getFixedPropertyValues()
PropertyValues, set application code prior to AndHow initialization.
The referenced Properties and values returned by this method and getFixedNamedValues()
are intended to be loaded by the StdFixedValueLoader, which nominally loads prior to any
other loader, effectively making the value non-configurable.
JndiContextWrapper getJndiContext()
Copyright © 2022. All rights reserved.