public abstract class PropFileBaseLoader extends BaseLoader implements ReadLoader, LocalFileLoader
| Modifier and Type | Field and Description |
|---|---|
protected boolean |
missingFileAProblem |
protected Property<String> |
pathProp
Property containing the path of a property file.
|
protected String |
pathStr
String containing path of a property file.
|
protected boolean |
unknownPropertyAProblem |
| Constructor and Description |
|---|
PropFileBaseLoader() |
| Modifier and Type | Method and Description |
|---|---|
SamplePrinter |
getConfigSamplePrinter()
Returns a ConfigSamplePrinter, which can be used to print a configuration
sample for this Loader.
|
protected String |
getEffectivePath(ValidatedValuesWithContext existingValues)
Utility method to simplify finding the effective path.
|
List<Property> |
getInstanceConfig()
A list of properties that the user has specified as being configuration
properties for this Loader.
|
String |
getLoaderDialect()
The type dialect of the loader.
|
String |
getLoaderType()
The type of the loader, such as JNDI, PropertyFile, SystemProperty,
etc..
|
boolean |
isFlaggable()
Returns true if this loader supports
FlaggableType's. |
boolean |
isMissingFileAProblem()
If true, a loader that loads from a file will report a Problem that will
stop application startup if it cannot find the configured file.
|
boolean |
isTrimmingRequiredForStringValues()
If true, values for string properties are trimmed by the Trimmer of
the property they are associated with.
|
boolean |
isUnknownPropertyAProblem()
If true, an unrecognized name is considered a problem that will stop
application startup.
|
LoaderValues |
loadInputStreamToProps(InputStream inputStream,
String fromPath,
PropertyConfigurationInternal appConfigDef,
ValidatedValuesWithContext existingValues) |
void |
setFilePath(Property<String> path)
Sets the path to the file to be loaded.
|
void |
setFilePath(String path)
Sets the path to the file to be loaded.
|
void |
setMissingFileAProblem(boolean isAProblem)
If set true, a file path that does not point to a file is a Problem/error.
|
void |
setUnknownPropertyAProblem(boolean isAProblem)
If true, an unrecognized property name is considered a problem/error.
|
attemptToAdd, attemptToAdd, attemptToAdd, attemptToAddIfNotDuplicate, createValue, findDuplicateProperty, getClassConfig, mapNametoProperty, releaseResourcesclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitgetClassConfig, getSpecificLoadDescription, load, releaseResourcesprotected Property<String> pathProp
protected String pathStr
protected boolean missingFileAProblem
protected boolean unknownPropertyAProblem
public LoaderValues loadInputStreamToProps(InputStream inputStream, String fromPath, PropertyConfigurationInternal appConfigDef, ValidatedValuesWithContext existingValues) throws org.yarnandtail.andhow.load.LoaderException
protected String getEffectivePath(ValidatedValuesWithContext existingValues)
existingValues - public List<Property> getInstanceConfig()
LoadergetInstanceConfig in interface LoadergetInstanceConfig in class BaseLoaderpublic boolean isTrimmingRequiredForStringValues()
LoaderisTrimmingRequiredForStringValues in interface Loaderpublic boolean isFlaggable()
LoaderFlaggableType's.
Loaders that support FlaggableType give special 'is present' meaning to a property being
present without a value, similar to a 'nix command line flag. If a Loader supports
flags, it should call FlaggableType.parseFlag(String) instead of
ValueType.parse(String) when a Property's ValueType is a FlaggableType.
See FlagProp for an example type.
Note: Returning true from this method is only potentially applicable to Loaders that parse strings. Loaders that directly load from rich values do not parse, so the loader logic would ignore the value here.
Examples:
Loading a non-null value from the properties file entry 'name = ' would be unexpected,
so a properties file Loader should return 'false' here.
However, a command line loader would be expected to support flags, so should return 'true'.
isFlaggable in interface Loaderpublic SamplePrinter getConfigSamplePrinter()
LoadergetConfigSamplePrinter in interface LoadergetConfigSamplePrinter in class BaseLoaderpublic String getLoaderType()
LoadergetLoaderType in interface Loaderpublic String getLoaderDialect()
LoadergetLoaderDialect in interface Loaderpublic void setUnknownPropertyAProblem(boolean isAProblem)
ReadLoadersetUnknownPropertyAProblem in interface ReadLoaderpublic boolean isUnknownPropertyAProblem()
ReadLoaderisUnknownPropertyAProblem in interface ReadLoaderpublic void setMissingFileAProblem(boolean isAProblem)
LocalFileLoadersetMissingFileAProblem in interface LocalFileLoaderpublic boolean isMissingFileAProblem()
LocalFileLoaderisMissingFileAProblem in interface LocalFileLoaderpublic void setFilePath(String path)
LocalFileLoader<String>
based method of the same name.setFilePath in interface LocalFileLoaderpublic void setFilePath(Property<String> path)
LocalFileLoadersetFilePath in interface LocalFileLoaderCopyright © 2022. All rights reserved.