public abstract class BaseFixedValueLoader extends BaseLoader implements ReadLoader
Two types of Property-value pairs are supported: PropertyValue's (a direct
reference to a Property and a typed value) and named properties (a Property canonical
name or alias and a value for it).
To implement a non-abstract class, override the
Loader.load(PropertyConfigurationInternal, LoaderEnvironment, ValidatedValuesWithContext)
method with a call to load(PropertyConfigurationInternal, Map, List) and supply your own
values for one or both of the two collections. For a simple example, see the
StdFixedValueLoader.
By default, this loader does not trim incoming values for String type properties and will
throw a RuntimeException if passed unrecognized properties. Both of these behaviours
can be changed by modifying the return values of isTrimmingRequiredForStringValues() and
isUnknownPropertyAProblem().
| Modifier and Type | Field and Description |
|---|---|
protected boolean |
unknownPropertyAProblem |
| Constructor and Description |
|---|
BaseFixedValueLoader() |
| Modifier and Type | Method and Description |
|---|---|
String |
getLoaderDialect()
The type dialect of the loader.
|
String |
getLoaderType()
The type of the loader, such as JNDI, PropertyFile, SystemProperty,
etc..
|
String |
getSpecificLoadDescription()
For this particular load, where was info loaded from?
This may vary from run to run based on config params.
|
boolean |
isFlaggable()
Returns true if this loader supports
FlaggableType's. |
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 |
load(PropertyConfigurationInternal runtimeDef,
Map<String,Object> fixedNamedValues,
List<PropertyValue<?>> fixedPropertyValues)
Load from the passed collections of property values.
|
void |
releaseResources()
Release any resources held by this loader.
|
void |
setUnknownPropertyAProblem(boolean isAProblem)
If true, an unrecognized property name is considered a problem/error.
|
attemptToAdd, attemptToAdd, attemptToAdd, attemptToAddIfNotDuplicate, createValue, findDuplicateProperty, getClassConfig, getConfigSamplePrinter, getInstanceConfig, mapNametoPropertyclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitgetClassConfig, getConfigSamplePrinter, getInstanceConfig, loadpublic LoaderValues load(PropertyConfigurationInternal runtimeDef, Map<String,Object> fixedNamedValues, List<PropertyValue<?>> fixedPropertyValues)
All arguements must be non-null.
runtimeDef - The definition of all known Properties and naming metadatafixedNamedValues - Fixed values referenced by namefixedPropertyValues - Fixed values reference by Property referencepublic 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 String getSpecificLoadDescription()
LoadergetSpecificLoadDescription in interface Loaderpublic 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 releaseResources()
LoaderreleaseResources in interface LoaderreleaseResources in class BaseLoaderCopyright © 2022. All rights reserved.