S - public abstract static class StdConfig.StdConfigAbstract<S extends StdConfig.StdConfigAbstract<S>> extends BaseConfig<S>
_cmdLineArgs, _fixedKeyObjectPairVals, _fixedVals, _missingClasspathPropFileAProblem, _missingFilesystemPropFileAProblem, classpathPropFilePathProp, classpathPropFilePathStr, DEFAULT_LOADER_LIST, envProperties, filesystemPropFilePathProp, insertAfter, insertBefore, naming, overrideGroups, standardLoaders, systemProperties| Constructor and Description |
|---|
StdConfigAbstract() |
| Modifier and Type | Method and Description |
|---|---|
<T> S |
addFixedValue(Property<T> property,
T value)
Sets a fixed, non-configurable value for a Property.
|
S |
addFixedValue(String propertyNameOrAlias,
Object value)
Sets a fixed, non-configurable value for a named Property.
|
S |
classpathPropertiesNotRequired()
Sets the properties file on the classpath to be optional, the default.
|
S |
classpathPropertiesRequired()
If called to set this to 'required', a classpath properties file must
exist and be readable.
|
S |
filesystemPropFileNotRequired()
Sets the properties file on the filesystem to be optional, the default.
|
S |
filesystemPropFileRequired()
If called to set this to 'required', a non-null configured value for the
filesystem properties file must point to an existing, readable properties
file.
|
S |
insertLoaderAfter(Class<? extends StandardLoader> insertAfterThisLoader,
Loader loaderToInsert) |
S |
insertLoaderBefore(Class<? extends StandardLoader> insertBeforeThisLoader,
Loader loaderToInsert) |
S |
removeFixedValue(Property<?> property)
Removes a Property value set only via addFixedValue(Property
|
S |
removeFixedValue(String propertyNameOrAlias)
Removes a Property value set only via addFixedValue(String name, Object value)
from the list of fixed values.
|
S |
setClasspathPropFilePath(String classpathPropFilePathString)
Sets the classpath path to a properties file for the
StdPropFileOnClasspathLoader to read and load from. |
S |
setClasspathPropFilePath(StrProp classpathPropFilePathProperty)
Sets the classpath path via a StrProp (a Property of String type) to a
properties file for the
StdPropFileOnClasspathLoader to read and load from. |
S |
setCmdLineArgs(String[] commandLineArgs)
Sets the command line arguments, removing any previously set commandline args.
|
S |
setEnvironmentProperties(Map<String,String> newEnvProperties)
Deprecated.
This method will be removed in a future release - it has no meaningful
usage. Use the addFixedValue() methods instead.
|
S |
setFilesystemPropFilePath(StrProp filesystemPropFilePath)
Sets the filesystem path via a StrProp (a Property of String type) to a
properties file for the StdPropFileOnFilesystemLoader to load.
|
S |
setStandardLoaders(Class<? extends StandardLoader>... newStandardLoaders) |
S |
setStandardLoaders(List<Class<? extends StandardLoader>> newStandardLoaders) |
S |
setSystemProperties(Properties properties)
Deprecated.
|
build, buildLoaders, buildStdEnvVarLoader, buildStdFixedValueLoader, buildStdJndiLoader, buildStdMainStringArgsLoader, buildStdPropFileOnClasspathLoader, buildStdPropFileOnFilesystemLoader, buildStdSysPropLoader, getDefaultLoaderList, getNamingStrategy, getRegisteredGroupspublic <T> S addFixedValue(Property<T> property, T value)
AndHowConfigurationaddFixedValue methods will
through a DuplicatePropertyLoaderProblem if they refer to
the same Property.T - The type of Property and valueproperty - The property to set a value forvalue - The value to set.public S removeFixedValue(Property<?> property)
AndHowConfigurationproperty - A non-null property.public S addFixedValue(String propertyNameOrAlias, Object value)
AndHowConfigurationaddFixedValue methods will
through a DuplicatePropertyLoaderProblem if they refer to
the same Property.propertyNameOrAlias - The canonical or alias name of Property, which is trimmed to null.value - The Object value to set, which must match the type of the Property.public S removeFixedValue(String propertyNameOrAlias)
AndHowConfigurationpropertyNameOrAlias - The name or alias of a property.public S setCmdLineArgs(String[] commandLineArgs)
AndHowConfigurationpublic S setClasspathPropFilePath(String classpathPropFilePathString)
AndHowConfigurationStdPropFileOnClasspathLoader to read and load from.
If no path is specified via one of the two setClasspathPropFilePath methods,
the default classpath of '/andhow.properties' is used.
As per Java convention, a path on the classpath can use dots or slashes to separate packages. However, if the file name itself contains dots, then the path must start with a slash and use slashes to separate packages.
Valid Examples:
public S setClasspathPropFilePath(StrProp classpathPropFilePathProperty)
AndHowConfigurationStdPropFileOnClasspathLoader to read and load from.
If no path is specified via one of the two setClasspathPropFilePath methods,
the default classpath of '/andhow.properties' is used.
As per Java convention, a path on the classpath can use dots or slashes to separate packages.
However, if the file name itself contains dots, then the path must start with a slash and use
slashes to separate packages. Its common to have a '.properties' extension on the properties
file, so its good practice to add a validation rule to the StrProp used here to ensure it
mustStartWith("/").
Valid Examples of configured values:
public S classpathPropertiesRequired()
AndHowConfigurationStdPropFileOnClasspathLoader.
Since the StdPropFileOnClasspathLoader has a default property file name,
/andhow.properties, setting this to 'required' means that either that
default file name or another that you configure instead must exist.public S classpathPropertiesNotRequired()
AndHowConfigurationAndHowConfiguration.classpathPropertiesRequired()public S setFilesystemPropFilePath(StrProp filesystemPropFilePath)
AndHowConfigurationpublic S filesystemPropFileRequired()
AndHowConfigurationStdPropFileOnFilesystemLoader.
A RuntimeException will be thrown if this is set to 'required' and there
is a path specified which points to a file that does not exist.
Configuring a filesystem path is a two step process:setFilesystemPropFilePath methodpublic S filesystemPropFileNotRequired()
AndHowConfiguration@Deprecated public S setSystemProperties(Properties properties)
properties - @Deprecated public S setEnvironmentProperties(Map<String,String> newEnvProperties)
StdEnvVarLoader loader.
If this method is not called or is called with a null Map, the actual env vars
from System.getenv() will be used. Calling this method with an empty
Map will effectively prevent AndHow from receiving configuration from env vars.
This does not actually change actual environment variables or what is
returned from System.getenv(). It only replaces what AndHow will see for env vars.
Note: There is no reason to use this method: Use one of the addFixedValue()
methods instead. Those methods are more clear, don't have to parse values, and
(unlike this method) are not deprecated.newEnvProperties - public S setStandardLoaders(List<Class<? extends StandardLoader>> newStandardLoaders)
public S setStandardLoaders(Class<? extends StandardLoader>... newStandardLoaders)
public S insertLoaderBefore(Class<? extends StandardLoader> insertBeforeThisLoader, Loader loaderToInsert)
public S insertLoaderAfter(Class<? extends StandardLoader> insertAfterThisLoader, Loader loaderToInsert)
Copyright © 2021. All rights reserved.