T
- The actual (sub-) type of the Properties
to be decorated.public abstract class AbstractResourcePropertiesDecorator<T extends ResourceProperties> extends AbstractPropertiesDecorator<T> implements ResourceProperties
ResourceProperties
and delegates method calls
to them ResourceProperties
.ResourceProperties.MutableResoureProperties, ResourceProperties.ResourcePropertiesBuilder
Properties.MutableProperties, Properties.PropertiesBuilder
org.refcodes.structure.CanonicalMap.CanonicalMapBuilder, org.refcodes.structure.CanonicalMap.MutableCanonicalMap
org.refcodes.structure.PathMap.MutablePathMap<T>, org.refcodes.structure.PathMap.PathMapBuilder<T>
org.refcodes.structure.Dictionary.MutableDictionary<K,V>
org.refcodes.structure.Keys.MutableKeys<K,V>, org.refcodes.structure.Keys.MutableValues<K,V>
org.refcodes.mixin.DelimiterAccessor.DelimiterBuilder<B extends org.refcodes.mixin.DelimiterAccessor.DelimiterBuilder<B>>, org.refcodes.mixin.DelimiterAccessor.DelimiterMutator, org.refcodes.mixin.DelimiterAccessor.DelimiterProperty
org.refcodes.mixin.TypeAccessor.TypeMutator<T>, org.refcodes.mixin.TypeAccessor.TypeProperty<T>
org.refcodes.structure.PropertiesAccessorMixin.PropertiesBuilderMixin<T>, org.refcodes.structure.PropertiesAccessorMixin.PropertiesMixin, org.refcodes.structure.PropertiesAccessorMixin.PropertiesMutatorMixin
_properties
DEFAULT_COMMENT
Modifier | Constructor and Description |
---|---|
protected |
AbstractResourcePropertiesDecorator()
Make sure to set the _properties member variable!
|
|
AbstractResourcePropertiesDecorator(T aProperties)
Decorates the provided
ResourceProperties with additional
behavior or functionality. |
Modifier and Type | Method and Description |
---|---|
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) ). |
void |
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. |
containsKey, get, getDelimiter, isEmpty, keySet, retrieveFrom, retrieveTo, size, toDataStructure, values
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
fileTo, fileTo, fileTo, fileTo, fileTo, fileTo, fileTo, fileTo, saveTo, saveTo, saveTo, saveTo, saveTo, saveTo, saveTo, saveTo, saveTo, saveTo, toSerialized, toSerialized
containsValue, getType, retrieve, retrieveFrom, retrieveTo, toMap, toProperties, toPropertyPath
toInstance, toInstance, toType, toType
directories, 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, toRootPath
containsKey, 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, useShort
protected AbstractResourcePropertiesDecorator()
public AbstractResourcePropertiesDecorator(T aProperties)
ResourceProperties
with additional
behavior or functionality. Changes applied to the provided
ResourceProperties
affect the decorator.aProperties
- The ResourceProperties
to be decorated.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 ResourceProperties
aOutputStream
- 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 ResourceProperties
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 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 ResourceProperties
aReloadMode
- 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 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 ResourceProperties
aFile
- 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).IOException
- thrown in case saving the properties failedCopyright © 2017. All rights reserved.