public class AbstractResourcePropertiesBuilderDecorator<T extends ResourceProperties.ResourcePropertiesBuilder> extends AbstractPropertiesBuilderDecorator<T> implements ResourceProperties.ResourcePropertiesBuilder
ResourceProperties.MutableResoureProperties, ResourceProperties.ResourcePropertiesBuilderProperties.MutableProperties, Properties.PropertiesBuilderorg.refcodes.structure.CanonicalMap.CanonicalMapBuilder, org.refcodes.structure.CanonicalMap.MutableCanonicalMaporg.refcodes.structure.PropertiesAccessorMixin.PropertiesBuilderMixin<T>, org.refcodes.structure.PropertiesAccessorMixin.PropertiesMixin, org.refcodes.structure.PropertiesAccessorMixin.PropertiesMutatorMixinorg.refcodes.structure.PathMap.MutablePathMap<T>, org.refcodes.structure.PathMap.PathMapBuilder<T>org.refcodes.mixin.DelimiterAccessor.DelimiterBuilder<B extends org.refcodes.mixin.DelimiterAccessor.DelimiterBuilder<B>>, org.refcodes.mixin.DelimiterAccessor.DelimiterMutator, org.refcodes.mixin.DelimiterAccessor.DelimiterPropertyorg.refcodes.mixin.TypeAccessor.TypeMutator<T>, org.refcodes.mixin.TypeAccessor.TypeProperty<T>org.refcodes.structure.Dictionary.MutableDictionary.DictionaryBuilder<K,V,B extends org.refcodes.structure.Dictionary.MutableDictionary.DictionaryBuilder<K,V,B>>_propertiesDEFAULT_COMMENT| Modifier | Constructor and Description |
|---|---|
protected |
AbstractResourcePropertiesBuilderDecorator()
Make sure to set the _properties member variable!
|
|
AbstractResourcePropertiesBuilderDecorator(T aProperties)
Decorates the provided
ResourceProperties.ResourcePropertiesBuilder with additional
behavior or functionality. |
| Modifier and Type | Method and Description |
|---|---|
void |
flush()
Flushes
ResourceProperties.MutableResoureProperties to the resource to which the
ResourceProperties are attached to (such as a File as
of ResourceProperties.MutableResoureProperties.loadFrom(File) or
ResourceProperties.saveTo(File)). |
Properties |
loadFrom(File aFile,
char... aDelimiters)
Loads the properties from the given
File. |
Properties |
loadFrom(InputStream aInputStream,
char... aDelimiters)
Loads the properties from the given
InputStream. |
Properties |
reload()
Reloads the
ResourceProperties from the resource to which the
ResourceProperties are attached to (such as a File as of
ResourceProperties.MutableResoureProperties.loadFrom(File) or
ResourceProperties.saveTo(File)). |
Properties |
reload(ReloadMode aReloadMode)
Reloads the
ResourceProperties from the resource to which the
ResourceProperties are attached to (such as a File as of
ResourceProperties.MutableResoureProperties.loadFrom(File) or
ResourceProperties.saveTo(File)). |
File |
saveTo(File aFile,
String aComment,
char aDelimiter)
Saves the properties to the given
File using the provided
delimiter as the destination's path delimiter. |
void |
saveTo(OutputStream aOutputStream,
String aComment,
char aDelimiter)
Saves the properties to the given
OutputStream using the provided
delimiter as the destination's path delimiter. |
Properties |
seekFrom(Class<?> aResourceClass,
String aFilePath,
char... aDelimiters)
Loads a properties file from the file path directly or (if not found)
from the first folder containing such a file as of the specification
for the method
RuntimeUtility.toConfigDirs(). |
clear, containsValue, entrySet, put, putAll, removechildrenOf, containsKey, get, getDelimiter, isEmpty, keySet, retrieveFrom, retrieveTo, size, toDataStructure, valuesclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitwithInsert, withInsert, withInsertFrom, withInsertTo, withLoadFrom, withLoadFrom, withLoadFrom, withLoadFrom, withLoadFrom, withLoadFrom, withLoadFrom, withLoadFrom, withLoadFrom, withLoadFrom, withPut, withPut, withPutBoolean, withPutByte, withPutDouble, withPutFloat, withPutInteger, withPutLong, withPutShort, withRemoveFrom, withSeekFrom, withSeekFrom, withSeekFrom, withSeekFrom, withSeekFrom, withSeekFromwithInsert, withInsert, withInsertFrom, withInsertTowithInsert, withInsert, withInsertFrom, withInsertTowithInsert, withInsert, withInsertFrom, withInsertTowithPutput, put, putBoolean, putBoolean, putByte, putByte, putDouble, putDouble, putFloat, putFloat, putInteger, putInteger, putLong, putLong, putShort, putShortloadFrom, loadFrom, loadFrom, loadFrom, loadFrom, loadFrom, loadFrom, loadFrom, parseFrom, parseFrom, seekFrom, seekFrom, seekFrom, seekFrom, seekFromfileTo, fileTo, fileTo, fileTo, fileTo, fileTo, fileTo, fileTo, saveTo, saveTo, saveTo, saveTo, saveTo, saveTo, saveTo, saveTo, saveTo, saveTo, toSerialized, toSerializedcontainsValue, delete, delete, insert, insert, insertFrom, insertTo, put, putAll, putAll, putAllchildrenOf, getType, retrieve, retrieveFrom, retrieveTo, toMap, toProperties, toPropertyPathinsert, insert, insertFrom, insertTo, putAll, toDump, toSourceCode, toSourceCodetoInstance, toInstance, toType, toTypecontainsKey, get, getBoolean, getBoolean, getByte, getByte, getCharacter, getCharacter, getDouble, getDouble, getFloat, getFloat, getInteger, getInteger, getLong, getLong, getShort, getShort, use, useBoolean, useBoolean, useByte, useByte, useDouble, useDouble, useFloat, useFloat, useInteger, useInteger, useLong, useLong, useShort, useShortinsert, insert, insert, insert, insertFrom, insertFrom, insertTo, insertTo, put, putArray, putArray, removeAlldirectories, directories, entries, entries, fromExternalKey, getArray, getArray, hasParentPath, isArray, isArray, isDirectory, isEntry, isRecord, isRootPath, keySet, paths, paths, records, records, toDataStructure, toDataStructure, toExternalKey, toMap, toNormalizedPath, toNormalizedPath, toParentPath, toPath, toRootPathprotected AbstractResourcePropertiesBuilderDecorator()
public AbstractResourcePropertiesBuilderDecorator(T aProperties)
ResourceProperties.ResourcePropertiesBuilder with additional
behavior or functionality. Changes applied to the provided
ResourceProperties.ResourcePropertiesBuilder affect the decorator.aProperties - The ResourceProperties to be decorated.public Properties loadFrom(InputStream aInputStream, char... aDelimiters) throws IOException, ParseException
InputStream. Save them
using the method ResourceProperties.saveTo(OutputStream).
This is the hook-method of the default implementation for loading the
properties. In case you want to implement ResourceProperties
which support other notations than the properties notation
(path=value), then you overwrite this method in your
implementation accordingly.loadFrom in interface ResourceProperties.MutableResourePropertiesaInputStream - The InputStream from which to load the
properties.aDelimiters - The path delimiters to be used when parsing the
source's properties (in case the the serialized format
supports / requires the such).Properties as loaded from the resource and
applied to this instance.IOException - thrown in case loading the properties failedParseException - Signals that an error has been reached
unexpectedly while parsing the data to be loaded.public Properties seekFrom(Class<?> aResourceClass, String aFilePath, char... aDelimiters) throws IOException, ParseException
RuntimeUtility.toConfigDirs(). Finally (if
nothing else succeeds) the properties are loaded by the provided
class's class loader which takes care of loading the properties (in
case the file path is a relative path, also the absolute path with a
prefixed path delimiter "/" is probed).
The default implementation uses the hook method
ResourceProperties.MutableResoureProperties.loadFrom(InputStream, char...) to finally load and parse the
properties.seekFrom in interface ResourceProperties.MutableResourePropertiesaResourceClass - The class which's class loader is to take care
of loading the properties (from inside a JAR).aFilePath - The file path from which to load the properties.aDelimiters - The path delimiters to be used when parsing the
source's properties (in case the the serialized format
supports / requires the such).Properties as loaded from the resource and
applied to this instance.IOException - thrown in case accessing or processing the
properties file failed.ParseException - Signals that an error has been reached
unexpectedly while parsing the data to be loaded.public void saveTo(OutputStream aOutputStream, String aComment, char aDelimiter) throws IOException
OutputStream using the provided
delimiter as the destination's path delimiter. Load them via
ResourceProperties.MutableResoureProperties.loadFrom(InputStream, char...)
This is the hook-method of the default implementation for writing
(saving) the properties. In case you want to implement
ResourceProperties which support other notations than the
properties notation (path=value), then you overwrite this
method in your implementation accordingly.saveTo in interface ResourcePropertiesaOutputStream - The OutputStream to which to save the
properties to.aComment - The description for the properties file.aDelimiter - The path delimiter to be used when writing out the
properties to the destination (in case the the serialized format
supports / requires the such).IOException - thrown in case saving the properties failedpublic Properties reload() throws IOException, IllegalStateException, ParseException
ResourceProperties from the resource to which the
ResourceProperties are attached to (such as a File as of
ResourceProperties.MutableResoureProperties.loadFrom(File) or
ResourceProperties.saveTo(File)).
In case the resource (such as an InputStream) does not support
reloading, then an IllegalStateException is thrown.
Properties existing in the attached resource as well in the
Properties itself are replaced. Properties existing in the
attached resource but not(!) in the Properties itself are not(!)
removed. Use ResourceProperties.reload(ReloadMode) with an argument of
true (~ orphan removal) to remove properties not existing in
the resource.reload in interface ResourcePropertiesProperties as loaded from the resource and applied to
this instance.IOException - thrown in case accessing the resource encountered an
I/O problem.IllegalStateException - in case the attached resource does not
support reloading.ParseException - Signals that an error has been reached
unexpectedly while parsing the data to be loaded.public Properties reload(ReloadMode aReloadMode) throws IOException, IllegalStateException, ParseException
ResourceProperties from the resource to which the
ResourceProperties are attached to (such as a File as of
ResourceProperties.MutableResoureProperties.loadFrom(File) or
ResourceProperties.saveTo(File)).
In case the resource (such as an InputStream) does not support
reloading, then an IllegalStateException is thrown.
Properties existing in the attached resource as well in the
Properties itself are replaced.
When "orphan removal" is set to false, then properties
existing in the attached resource but not(!) in the Properties
itself are not(!) removed. When "orphan removal" is set to
true, then properties existing in the attached resource but
not(!) in the Properties itself are(!) removed.reload in interface ResourcePropertiesaReloadMode - when set to ReloadMode.ORPHAN_REMOVAL, then
properties existing in the attached resource but not(!) in the
Properties itself are(!) removed. Else properties not
existing in the attached resource are kept.Properties as loaded from the resource and applied to
this instance.IOException - thrown in case accessing the resource encountered an
I/O problem.IllegalStateException - in case the attached resource does not
support reloading.ParseException - Signals that an error has been reached
unexpectedly while parsing the data to be loaded.public void flush()
throws org.refcodes.component.OpenException
ResourceProperties.MutableResoureProperties to the resource to which the
ResourceProperties are attached to (such as a File as
of ResourceProperties.MutableResoureProperties.loadFrom(File) or
ResourceProperties.saveTo(File)).
flush in interface Flushableflush in interface ResourceProperties.MutableResourePropertiesorg.refcodes.component.OpenExceptionpublic File saveTo(File aFile, String aComment, char aDelimiter) throws IOException
File using the provided
delimiter as the destination's path delimiter. Load them via
ResourceProperties.MutableResoureProperties.loadFrom(File, char...).
The default implementation uses the hook method
ResourceProperties.saveTo(OutputStream, String, char) to finally format and write
the properties.saveTo in interface ResourcePropertiesaFile - The File from which to load the properties.aComment - The description for the properties file.aDelimiter - The path delimiter to be used when writing out the
properties to the destination (in case the the serialized format
supports / requires the such).File representing the actual location where the
properties have been saved to.IOException - thrown in case saving the properties failedpublic Properties loadFrom(File aFile, char... aDelimiters) throws IOException, ParseException
File. Save them using the
method ResourceProperties.saveTo(File).
The default implementation uses the hook method
ResourceProperties.MutableResoureProperties.loadFrom(InputStream, char...) to finally load and parse the
properties.loadFrom in interface ResourceProperties.MutableResourePropertiesaFile - The File from which to load the properties.aDelimiters - The path delimiters to be used when parsing the
source's properties (in case the the serialized format
supports / requires the such).Properties as loaded from the resource and
applied to this instance.IOException - thrown in case loading the properties failedParseException - Signals that an error has been reached
unexpectedly while parsing the data to be loaded.Copyright © 2018. All rights reserved.