public class LoaderEnvironmentImm extends Object implements LoaderEnvironment
| Constructor and Description |
|---|
LoaderEnvironmentImm(Map<String,String> envVars,
Map<String,String> sysProps,
List<String> cmdLineArgs,
Map<String,Object> fixedNamedValues,
List<PropertyValue<?>> fixedPropertyValues,
Supplier<JndiContextWrapper> jndiContextSupplier)
A new LoaderEnvironmentImm instance.
|
| 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.
|
public LoaderEnvironmentImm(Map<String,String> envVars, Map<String,String> sysProps, List<String> cmdLineArgs, Map<String,Object> fixedNamedValues, List<PropertyValue<?>> fixedPropertyValues, Supplier<JndiContextWrapper> jndiContextSupplier)
All passed values may be null or empty, resulting in that aspect of the environment being empty
for the Loaders. Thus, to have the actual values of
System.getenv() available to the Loaders, the return value of
System.getenv() must be passed in this constructor, and so on.
fixedNamedValues and fixedPropertyValues are different ways of specifying fixed
values, both of which will be used. See the related get methods for more details.
This immutable class wraps the passed collections in an unmodifiable wrapper, but does not
copy the values to a new collection. Thus, callers should not hold references to the passed
collections.
envVars - The environment vars (System.getenv()) that the Loaders will see.sysProps - The system properties (System.getProperties()) as a MapcmdLineArgs - The command line arguments (passed to main(String[] args) that the Loaders will see.fixedNamedValues - The hard-coded/fixed named Property values that the Loaders will see.fixedPropertyValues - The hard-coded/fixed PropertyValues that the Loaders will see.jndiContextSupplier - A lambda that returns a JNDI Contextpublic Map<String,String> getEnvVars()
LoaderEnvironment
Nominally the same as System.getenv(), but may be customized for testing.
getEnvVars in interface LoaderEnvironmentpublic Map<String,String> getSysProps()
LoaderEnvironment
Nominally the same as System.getProperties(), but may be customized for testing.
getSysProps in interface LoaderEnvironmentpublic List<String> getCmdLineArgs()
LoaderEnvironmentmain(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.
getCmdLineArgs in interface LoaderEnvironmentpublic Map<String,Object> getFixedNamedValues()
LoaderEnvironment
The referenced Properties and values returned by this method and LoaderEnvironment.getFixedPropertyValues()
are intended to be loaded by the StdFixedValueLoader, which nominally loads prior to any
other loader, effectively making the value non-configurable.
getFixedNamedValues in interface LoaderEnvironmentpublic List<PropertyValue<?>> getFixedPropertyValues()
LoaderEnvironmentPropertyValues, set application code prior to AndHow initialization.
The referenced Properties and values returned by this method and LoaderEnvironment.getFixedNamedValues()
are intended to be loaded by the StdFixedValueLoader, which nominally loads prior to any
other loader, effectively making the value non-configurable.
getFixedPropertyValues in interface LoaderEnvironmentpublic JndiContextWrapper getJndiContext()
LoaderEnvironmentgetJndiContext in interface LoaderEnvironmentCopyright © 2022. All rights reserved.