public interface ResourceProperties extends Properties
ResourceProperties
are a specialization of the
Dictionary
. Properties represent a collection if String
key
and String
value pairs as properties usually occur in pure text form,
to be converted to the required data types. For this reason, the
ResourceProperties
interface provides additional conversion methods.Modifier and Type | Interface and Description |
---|---|
static interface |
ResourceProperties.MutableResoureProperties
The interface
ResourceProperties.MutableResoureProperties defines "dirty" methods
allowing to modify ("mutate") the ResourceProperties . |
static interface |
ResourceProperties.ResourcePropertiesBuilder
The interface
ResourceProperties.ResourcePropertiesBuilder defines builder
functionality on top of the ResourceProperties.MutableResoureProperties . |
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
Modifier and Type | Field and Description |
---|---|
static String |
DEFAULT_COMMENT |
Modifier and Type | Method and Description |
---|---|
default File |
fileTo(File aFile)
Files (writes) the properties to the given
File . |
default File |
fileTo(File aFile,
char aDelimiter)
Files (writes) the properties to the given
File using the
provided delimiter as the destination's path delimiter. |
default File |
fileTo(File aFile,
String aComment)
Files (writes) the properties to the given
File . |
default File |
fileTo(File aFile,
String aComment,
char aDelimiter)
Files (writes) the properties to the given
File using the
provided delimiter as the destination's path delimiter. |
default File |
fileTo(String aFilePath)
Files (writes) the properties to the given
File . |
default File |
fileTo(String aFilePath,
char aDelimiter)
Files (writes) the properties to the given
File using the
provided delimiter as the destination's path delimiter. |
default File |
fileTo(String aFilePath,
String aComment)
Files (writes) the properties to the
File represented by the
given file path. |
default File |
fileTo(String aFilePath,
String aComment,
char aDelimiter)
Files (writes) the properties to the
File represented by the
given file path using the provided delimiter as the destination's path
delimiter. |
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
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
saveTo(File) ). |
default File |
saveTo(File aFile)
Saves the properties to the given
File . |
default File |
saveTo(File aFile,
char aDelimiter)
Saves the properties to the given
File using the provided
delimiter as the destination's path delimiter. |
default File |
saveTo(File aFile,
String aComment)
Saves the properties to the given
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. |
default void |
saveTo(OutputStream aOutputStream)
Saves the properties to the given
OutputStream . |
default void |
saveTo(OutputStream aOutputStream,
char aDelimiter)
Saves the properties to the given
OutputStream . |
default void |
saveTo(OutputStream aOutputStream,
String aComment)
Saves the properties to the given
OutputStream . |
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. |
default File |
saveTo(String aFilePath)
Saves the properties to the given
File . |
default File |
saveTo(String aFilePath,
char aDelimiter)
Saves the properties to the given
File using the provided
delimiter as the destination's path delimiter. |
default File |
saveTo(String aFilePath,
String aComment)
Saves the properties to the
File represented by the given file
path. |
default File |
saveTo(String aFilePath,
String aComment,
char aDelimiter)
Saves the properties to the
File represented by the given file
path using the provided delimiter as the destination's path delimiter. |
default String |
toSerialized()
Produces the external representation of the properties as of the
serialized format supported by the implementing class.
|
default String |
toSerialized(char aDelimiter)
Produces the external representation of the properties as of the
serialized format supported by the implementing class.
|
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
static final String DEFAULT_COMMENT
default File saveTo(String aFilePath) throws IOException
File
. Load them via
ResourceProperties.MutableResoureProperties.loadFrom(File)
The default implementation uses the hook method
saveTo(OutputStream, String, char)
to finally format and write
the properties.aFilePath
- The file path from which to load the properties.File
representing the actual location where the
properties have been saved to.IOException
- thrown in case saving the properties faileddefault File saveTo(String aFilePath, char aDelimiter) throws IOException
File
using the provided
delimiter as the destination's path delimiter. Load them via
ResourceProperties.MutableResoureProperties.loadFrom(String, char...)
The default implementation uses the hook method
saveTo(OutputStream, String, char)
to finally format and write
the properties.aFilePath
- The file path from which to load the properties.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 faileddefault File saveTo(File aFile) throws IOException
File
. Load them via
ResourceProperties.MutableResoureProperties.loadFrom(File)
.
The default implementation uses the hook method
saveTo(OutputStream, String, char)
to finally format and write
the properties.aFile
- The File
from which to load the properties.File
representing the actual location where the
properties have been saved to.IOException
- thrown in case saving the properties faileddefault File saveTo(File aFile, 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
saveTo(OutputStream, String, char)
to finally format and write
the properties.aFile
- The File
from which to load the properties.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 faileddefault File saveTo(String aFilePath, String aComment) throws IOException
File
represented by the given file
path. Load them via ResourceProperties.MutableResoureProperties.loadFrom(String)
.
The default implementation uses the hook method
saveTo(OutputStream, String, char)
to finally format and write
the properties.aFilePath
- The file path from which to load the properties.aComment
- The description for the properties file.File
representing the actual location where the
properties have been saved to.IOException
- thrown in case saving the properties faileddefault File saveTo(String aFilePath, String aComment, char aDelimiter) throws IOException
File
represented by the given file
path 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
saveTo(OutputStream, String, char)
to finally format and write
the properties.aFilePath
- The file path from which to load the properties.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).aComment
- The description for the properties file.File
representing the actual location where the
properties have been saved to.IOException
- thrown in case saving the properties faileddefault File saveTo(File aFile, String aComment) throws IOException
File
. Load them via
ResourceProperties.MutableResoureProperties.loadFrom(File)
.
The default implementation uses the hook method
saveTo(OutputStream, String, char)
to finally format and write
the properties.aFile
- The File
from which to load the properties.aComment
- The description for the properties file.File
representing the actual location where the
properties have been saved to.IOException
- thrown in case saving the properties failedFile 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
saveTo(OutputStream, String, char)
to finally format and write
the properties.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).File
representing the actual location where the
properties have been saved to.IOException
- thrown in case saving the properties faileddefault void saveTo(OutputStream aOutputStream) throws IOException
OutputStream
. Load them via
ResourceProperties.MutableResoureProperties.loadFrom(InputStream)
.
The default implementation uses the hook method
saveTo(OutputStream, String, char)
to finally format and write
the properties.aOutputStream
- the a output streamIOException
- thrown in case saving the properties faileddefault void saveTo(OutputStream aOutputStream, char aDelimiter) throws IOException
OutputStream
. Load them via
ResourceProperties.MutableResoureProperties.loadFrom(InputStream, char...)
.
The default implementation uses the hook method
saveTo(OutputStream, String, char)
to finally format and write
the properties.aOutputStream
- the OutputStream
where to write the
properties to.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 faileddefault void saveTo(OutputStream aOutputStream, String aComment) throws IOException
OutputStream
. Load them via
ResourceProperties.MutableResoureProperties.loadFrom(InputStream)
The default implementation uses the hook method
saveTo(OutputStream, String, char)
to finally format and write
the properties.aOutputStream
- The OutputStream
to which to save the
properties to.aComment
- The description for the properties file.IOException
- thrown in case saving the properties failedvoid 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.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 faileddefault File fileTo(String aFilePath) throws IOException
File
. The properties
are filed to the first folder detected by the method
RuntimeUtility.toConfigDirs(File)
. Load them via
ResourceProperties.MutableResoureProperties.seekFrom(File)
The default implementation uses the hook method
fileTo(String, String, char)
to finally format and write the
properties.aFilePath
- The file path from which to load the properties.File
representing the actual location where the
properties have been saved to.IOException
- thrown in case saving the properties faileddefault File fileTo(String aFilePath, char aDelimiter) throws IOException
File
using the
provided delimiter as the destination's path delimiter. The properties
are filed to the first folder detected by the method
RuntimeUtility.toConfigDirs(File)
. Load them via
ResourceProperties.MutableResoureProperties.seekFrom(String, char...)
The default implementation uses the hook method
fileTo(File, String, char)
to finally format and write the
properties.aFilePath
- The file path from which to load the properties.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 faileddefault File fileTo(File aFile) throws IOException
File
. The properties
are filed to the first folder detected by the method
RuntimeUtility.toConfigDirs(File)
. Load them via
ResourceProperties.MutableResoureProperties.seekFrom(File)
.
The default implementation uses the hook method
fileTo(File, String, char)
to finally format and write the
properties.aFile
- The File
from which to load the properties.File
representing the actual location where the
properties have been saved to.IOException
- thrown in case saving the properties faileddefault File fileTo(File aFile, char aDelimiter) throws IOException
File
using the
provided delimiter as the destination's path delimiter. The properties
are filed to the first folder detected by the method
RuntimeUtility.toConfigDirs(File)
. Load them via
ResourceProperties.MutableResoureProperties.seekFrom(File, char...)
.
The default implementation uses the hook method
fileTo(File, String, char)
to finally format and write the
properties.aFile
- The File
from which to load the properties.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 faileddefault File fileTo(String aFilePath, String aComment) throws IOException
File
represented by the
given file path. The properties are filed to the first folder detected by
the method RuntimeUtility.toConfigDirs(File)
. Load them via
ResourceProperties.MutableResoureProperties.seekFrom(String)
.
The default implementation uses the hook method
fileTo(File, String, char)
to finally format and write the
properties.aFilePath
- The file path from which to load the properties.aComment
- The description for the properties file.File
representing the actual location where the
properties have been saved to.IOException
- thrown in case saving the properties faileddefault File fileTo(String aFilePath, String aComment, char aDelimiter) throws IOException
File
represented by the
given file path using the provided delimiter as the destination's path
delimiter. The properties are filed to the first folder detected by the
method RuntimeUtility.toConfigDirs(File)
. Load them via
ResourceProperties.MutableResoureProperties.seekFrom(File, char...)
.
The default implementation uses the hook method
fileTo(File, String, char)
to finally format and write the
properties.aFilePath
- The file path from which to load the properties.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).aComment
- The description for the properties file.File
representing the actual location where the
properties have been saved to.IOException
- thrown in case saving the properties faileddefault File fileTo(File aFile, String aComment) throws IOException
File
. The properties
are filed to the first folder detected by the method
RuntimeUtility.toConfigDirs(File)
. Load them via
ResourceProperties.MutableResoureProperties.seekFrom(File)
.
The default implementation uses the hook method
fileTo(File, String, char)
to finally format and write the
properties.aFile
- The File
from which to load the properties.aComment
- The description for the properties file.File
representing the actual location where the
properties have been saved to.IOException
- thrown in case saving the properties faileddefault File fileTo(File aFile, String aComment, char aDelimiter) throws IOException
File
using the
provided delimiter as the destination's path delimiter. The properties
are filed to the first folder detected by the method
RuntimeUtility.toConfigDirs(File)
. Load them via
ResourceProperties.MutableResoureProperties.seekFrom(File, char...)
.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).File
representing the actual location where the
properties have been saved to.IOException
- thrown in case saving the properties faileddefault String toSerialized()
default String toSerialized(char aDelimiter)
aDelimiter
- The path delimiter to be used when serializing the
properties (in case the the serialized format supports / requires
the such).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
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 reload(ReloadMode)
with an argument of
true
(~ orphan removal) to remove properties not existing in
the resource.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.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
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.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.Copyright © 2018. All rights reserved.