Package org.refcodes.configuration
Class AbstractResourcePropertiesBuilder
- java.lang.Object
-
- org.refcodes.structure.PathMapBuilderImpl<java.lang.String>
-
- org.refcodes.configuration.PropertiesBuilderImpl
-
- org.refcodes.configuration.AbstractResourcePropertiesBuilder
-
- All Implemented Interfaces:
java.io.Flushable
,java.util.Map<java.lang.String,T>
,org.refcodes.component.Flushable
,org.refcodes.component.Flushable.FlushBuilder<java.lang.String>
,Properties
,Properties.MutableProperties
,Properties.PropertiesBuilder
,ResourceProperties
,ResourceProperties.MutableResoureProperties
,ResourceProperties.ResourcePropertiesBuilder
,org.refcodes.mixin.DelimiterAccessor
,org.refcodes.mixin.Dumpable
,org.refcodes.mixin.TypeAccessor<java.lang.String>
,org.refcodes.structure.CanonicalMap
,org.refcodes.structure.CanonicalMap.CanonicalMapBuilder
,org.refcodes.structure.CanonicalMap.MutableCanonicalMap
,org.refcodes.structure.Clearable
,org.refcodes.structure.Containable
,org.refcodes.structure.Dictionary<java.lang.String,T>
,org.refcodes.structure.Dictionary.MutableDictionary<java.lang.String,T>
,org.refcodes.structure.Dictionary.MutableDictionary.DictionaryBuilder<java.lang.String,T,org.refcodes.structure.PathMap.PathMapBuilder<T>>
,org.refcodes.structure.Keys<java.lang.String,T>
,org.refcodes.structure.Keys.MutableKeys<java.lang.String,T>
,org.refcodes.structure.Keys.MutableValues<java.lang.String,T>
,org.refcodes.structure.PathMap<java.lang.String>
,org.refcodes.structure.PathMap.MutablePathMap<java.lang.String>
,org.refcodes.structure.PathMap.PathMapBuilder<java.lang.String>
,org.refcodes.structure.PropertiesAccessorMixin
,org.refcodes.structure.PropertiesAccessorMixin.PropertiesBuilderMixin<java.lang.String>
,org.refcodes.structure.PropertiesAccessorMixin.PropertiesMixin
,org.refcodes.structure.PropertiesAccessorMixin.PropertiesMutatorMixin
- Direct Known Subclasses:
JavaPropertiesBuilder
,JsonPropertiesBuilder
,TomlPropertiesBuilder
,XmlPropertiesBuilder
,YamlPropertiesBuilder
public abstract class AbstractResourcePropertiesBuilder extends PropertiesBuilderImpl implements ResourceProperties.ResourcePropertiesBuilder
Implementation of the mutableResourceProperties.ResourcePropertiesBuilder
interface.- See Also:
- Serialized Form
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface org.refcodes.structure.CanonicalMap
org.refcodes.structure.CanonicalMap.CanonicalMapBuilder, org.refcodes.structure.CanonicalMap.MutableCanonicalMap
-
Nested classes/interfaces inherited from interface org.refcodes.mixin.DelimiterAccessor
org.refcodes.mixin.DelimiterAccessor.DelimiterBuilder<B extends org.refcodes.mixin.DelimiterAccessor.DelimiterBuilder<B>>, org.refcodes.mixin.DelimiterAccessor.DelimiterMutator, org.refcodes.mixin.DelimiterAccessor.DelimiterProperty
-
Nested classes/interfaces inherited from interface org.refcodes.structure.Dictionary
org.refcodes.structure.Dictionary.MutableDictionary<K extends java.lang.Object,V extends java.lang.Object>
-
Nested classes/interfaces inherited from interface org.refcodes.structure.Dictionary.MutableDictionary
org.refcodes.structure.Dictionary.MutableDictionary.DictionaryBuilder<K extends java.lang.Object,V extends java.lang.Object,B extends org.refcodes.structure.Dictionary.MutableDictionary.DictionaryBuilder<K,V,B>>
-
Nested classes/interfaces inherited from interface org.refcodes.component.Flushable
org.refcodes.component.Flushable.FlushBuilder<B extends org.refcodes.component.Flushable.FlushBuilder<B>>
-
Nested classes/interfaces inherited from interface org.refcodes.structure.PathMap
org.refcodes.structure.PathMap.MutablePathMap<T extends java.lang.Object>, org.refcodes.structure.PathMap.PathMapBuilder<T extends java.lang.Object>
-
Nested classes/interfaces inherited from interface org.refcodes.configuration.Properties
Properties.MutableProperties, Properties.PropertiesBuilder
-
Nested classes/interfaces inherited from interface org.refcodes.structure.PropertiesAccessorMixin
org.refcodes.structure.PropertiesAccessorMixin.PropertiesBuilderMixin<T extends java.lang.Object>, org.refcodes.structure.PropertiesAccessorMixin.PropertiesMixin, org.refcodes.structure.PropertiesAccessorMixin.PropertiesMutatorMixin
-
Nested classes/interfaces inherited from interface org.refcodes.configuration.ResourceProperties
ResourceProperties.MutableResoureProperties, ResourceProperties.ResourcePropertiesBuilder
-
-
Field Summary
Fields Modifier and Type Field Description protected java.io.File
_propertiesFile
-
Fields inherited from interface org.refcodes.configuration.ResourceProperties
VALUE_ATTRIBUTES
-
Fields inherited from interface org.refcodes.configuration.ResourceProperties.MutableResoureProperties
DEFAULT_COMMENT
-
-
Constructor Summary
Constructors Modifier Constructor Description protected
AbstractResourcePropertiesBuilder()
Create an emptyAbstractResourcePropertiesBuilder
instance using the default path delimiter "/" (Delimiter.PATH
) for the path declarations.protected
AbstractResourcePropertiesBuilder(java.io.File aFile)
Loads the properties from the givenFile
.protected
AbstractResourcePropertiesBuilder(java.io.File aFile, char... aDelimiters)
Loads the properties from the givenFile
.protected
AbstractResourcePropertiesBuilder(java.io.File aFile, org.refcodes.runtime.ConfigLocator aConfigLocator)
Loads or seeks the properties from the givenFile
.protected
AbstractResourcePropertiesBuilder(java.io.File aFile, org.refcodes.runtime.ConfigLocator aConfigLocator, char... aDelimiters)
Loads or seeks the properties from the givenFile
.protected
AbstractResourcePropertiesBuilder(java.io.InputStream aInputStream)
Reads the properties from the givenInputStream
.protected
AbstractResourcePropertiesBuilder(java.io.InputStream aInputStream, char... aDelimiters)
Reads the properties from the givenInputStream
.protected
AbstractResourcePropertiesBuilder(java.lang.Class<?> aResourceClass, java.lang.String aFilePath)
Loads the properties from the given file's path.protected
AbstractResourcePropertiesBuilder(java.lang.Class<?> aResourceClass, java.lang.String aFilePath, char... aDelimiters)
Loads the properties from the given file's path.protected
AbstractResourcePropertiesBuilder(java.lang.Class<?> aResourceClass, java.lang.String aFilePath, org.refcodes.runtime.ConfigLocator aConfigLocator)
Loads the properties from the given file's path.protected
AbstractResourcePropertiesBuilder(java.lang.Class<?> aResourceClass, java.lang.String aFilePath, org.refcodes.runtime.ConfigLocator aConfigLocator, char... aDelimiters)
Loads the properties from the given file's path.protected
AbstractResourcePropertiesBuilder(java.lang.Object aObj)
Create aAbstractResourcePropertiesBuilder
instance containing the elements as ofPathMap.MutablePathMap.insert(Object)
using the default path delimiter "/" (Delimiter.PATH
) for the path declarations: "Inspects the given object and adds all elements found in the given object.AbstractResourcePropertiesBuilder(java.lang.String aFilePath)
Loads the properties from the given file's path.protected
AbstractResourcePropertiesBuilder(java.lang.String aFilePath, char... aDelimiters)
Loads the properties from the given file's path.protected
AbstractResourcePropertiesBuilder(java.lang.String aFilePath, org.refcodes.runtime.ConfigLocator aConfigLocator)
Loads the properties from the given file's path.protected
AbstractResourcePropertiesBuilder(java.lang.String aFilePath, org.refcodes.runtime.ConfigLocator aConfigLocator, char... aDelimiters)
Loads the properties from the given file's path.protected
AbstractResourcePropertiesBuilder(java.net.URL aUrl)
Loads the properties from the givenURL
.protected
AbstractResourcePropertiesBuilder(java.net.URL aUrl, char... aDelimiters)
Loads the properties from the givenURL
.protected
AbstractResourcePropertiesBuilder(java.util.Map<?,?> aProperties)
Create aAbstractResourcePropertiesBuilder
instance containing the elements of the providedMap
instance using the default path delimiter "/" (Delimiter.PATH
) for the path declarationsprotected
AbstractResourcePropertiesBuilder(Properties aProperties)
Create aAbstractResourcePropertiesBuilder
instance containing the elements of the providedProperties
instance using the default path delimiter "/" (Delimiter.PATH
) for the path declarationsprotected
AbstractResourcePropertiesBuilder(Properties.PropertiesBuilder aProperties)
Create aAbstractResourcePropertiesBuilder
instance containing the elements of the providedProperties.PropertiesBuilder
instance using the default path delimiter "/" (Delimiter.PATH
) for the path declarations
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected abstract org.refcodes.structure.ext.factory.CanonicalMapFactory
createCanonicalMapFactory()
Abstract method to be implemented by the sub-classes returning the concreteCanonicalMapFactory
responsible to fabricate theCanonicalMap
instances as of the required notation.void
flush()
FlushesResourceProperties.MutableResoureProperties
to the resource to which theResourceProperties
are attached to (such as aFile
as ofResourceProperties.MutableResoureProperties.loadFrom(File)
orResourceProperties.MutableResoureProperties.saveTo(File)
).boolean
isFlushable()
In case the resource has not been loaded from a writableFile
, then calling this method will return false.Properties
loadFrom(java.io.File aFile, char... aDelimiters)
Loads the properties from the givenFile
.Properties
loadFrom(java.io.InputStream aInputStream, char... aDelimiters)
Loads the properties from the givenInputStream
.Properties
reload()
Reloads theResourceProperties
from the resource to which theResourceProperties
are attached to (such as aFile
as ofResourceProperties.MutableResoureProperties.loadFrom(File)
orResourceProperties.MutableResoureProperties.saveTo(File)
).Properties
reload(ReloadMode aReloadMode)
Reloads theResourceProperties
from the resource to which theResourceProperties
are attached to (such as aFile
as ofResourceProperties.MutableResoureProperties.loadFrom(File)
orResourceProperties.MutableResoureProperties.saveTo(File)
).java.io.File
saveTo(java.io.File aFile, java.lang.String aComment, char aDelimiter)
Saves the properties to the givenFile
using the provided delimiter as the destination's path delimiter.void
saveTo(java.io.OutputStream aOutputStream, java.lang.String aComment, char aDelimiter)
The comment is ignored for the JSON format as JSON does not(!)Properties
seekFrom(java.lang.Class<?> aResourceClass, java.lang.String aFilePath, org.refcodes.runtime.ConfigLocator aConfigLocator, 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 theConfigLocator
configuration passed.-
Methods inherited from interface org.refcodes.structure.CanonicalMap
getBoolean, getBoolean, getBooleanOr, getBooleanOr, getByte, getByte, getByteOr, getByteOr, getCharacter, getCharacter, getCharacterOr, getCharacterOr, getDouble, getDouble, getDoubleOr, getDoubleOr, getFloat, getFloat, getFloatOr, getFloatOr, getInteger, getInteger, getIntegerOr, getIntegerOr, getLong, getLong, getLongOr, getLongOr, getShort, getShort, getShortOr, getShortOr, toInstance, toInstance, toMap, toProperties, toType, toType
-
Methods inherited from interface org.refcodes.structure.CanonicalMap.CanonicalMapBuilder
withMerge, withMerge, withMergeBetween, withMergeBetween, withMergeBetween, withMergeBetween, withMergeBetween, withMergeBetween, withMergeBetween, withMergeBetween, withMergeBetween, withMergeBetween, withMergeFrom, withMergeFrom, withMergeFrom, withMergeFrom, withMergeFrom, withMergeFrom, withMergeFrom, withMergeFrom, withMergeFrom, withMergeFrom, withMergeTo, withMergeTo, withMergeTo, withMergeTo, withMergeTo, withMergeTo, withMergeTo, withMergeTo, withMergeTo, withMergeTo
-
Methods inherited from interface org.refcodes.structure.CanonicalMap.MutableCanonicalMap
insert, insertBetween, insertFrom, insertTo, put, put, putAll, putBoolean, putBoolean, putByte, putByte, putDouble, putDouble, putFloat, putFloat, putInteger, putInteger, putLong, putLong, putShort, putShort, removeFrom, toDump, toSourceCode, toSourceCode
-
Methods inherited from interface org.refcodes.component.Flushable.FlushBuilder
withFlush, withFlushUnchecked
-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface org.refcodes.structure.PathMap
children, children, children, children, children, children, containsKey, containsKey, containsKey, dirs, dirs, dirs, dirs, dirs, dirs, findPaths, fromExternalPath, get, get, get, getArray, getArray, getArray, getArray, getArray, getArrayIndexes, getArrayIndexes, getArrayIndexes, getArrayIndexes, getArrayIndexes, getDirAt, getDirAt, getDirAt, getDirAt, getDirIndexes, getDirIndexes, getDirIndexes, getDirIndexes, getDirIndexes, getRootPath, getValueAt, getValueAt, getValueAt, getValueAt, getValueAt, getValueAt, hasChildren, hasChildren, hasChildren, hasChildren, hasChildren, hasDirAt, hasDirAt, hasDirAt, hasDirAt, hasDirAt, hasDirAt, hasDirAt, hasDirAt, hasDirAt, hasDirAt, hasDirAt, hasParentPath, hasPath, hasPath, hasPath, hasPath, hasValueAt, hasValueAt, hasValueAt, hasValueAt, hasValueAt, hasValueAt, hasValueAt, hasValueAt, isArray, isArray, isArray, isArray, isArray, isArray, isArrayIndex, isArrayIndex, isArrayIndex, isArrayIndex, isArrayIndex, isArrayIndex, isChild, isChild, isChild, isChild, isDir, isDir, isDir, isDir, isDir, isDirIndex, isDirIndex, isDirIndex, isDirIndex, isDirIndex, isLeaf, isLeaf, isLeaf, isLeaf, isLeaf, isRootPath, keySet, lastArrayIndex, lastArrayIndex, lastArrayIndex, lastArrayIndex, lastArrayIndex, lastArrayIndex, lastDirIndex, lastDirIndex, lastDirIndex, lastDirIndex, lastDirIndex, lastDirIndex, leaves, leaves, leaves, leaves, leaves, leaves, nextArrayIndex, nextArrayIndex, nextArrayIndex, nextArrayIndex, nextArrayIndex, nextArrayIndex, nextDirIndex, nextDirIndex, nextDirIndex, nextDirIndex, nextDirIndex, nextDirIndex, paths, paths, paths, paths, paths, paths, queryPaths, queryPaths, queryPaths, queryPaths, queryPaths, sortedKeys, toDataStructure, toDataStructure, toExternalPath, toLeaf, toMap, toNormalizedPath, toParentPath, toPath, toPath, toPath, toPathElements, toPathList, toPathStack, toPropertyPath
-
Methods inherited from interface org.refcodes.structure.PathMap.MutablePathMap
appendDirTo, appendDirTo, appendDirTo, appendDirTo, appendDirTo, appendDirTo, appendDirTo, appendDirTo, appendDirTo, appendDirTo, appendDirTo, appendDirTo, appendValueTo, appendValueTo, appendValueTo, appendValueTo, appendValueTo, appendValueTo, delete, delete, delete, delete, insert, insert, insertBetween, insertBetween, insertBetween, insertBetween, insertBetween, insertBetween, insertBetween, insertBetween, insertBetween, insertBetween, insertFrom, insertFrom, insertFrom, insertFrom, insertFrom, insertFrom, insertFrom, insertFrom, insertFrom, insertFrom, insertTo, insertTo, insertTo, insertTo, insertTo, insertTo, insertTo, insertTo, insertTo, insertTo, merge, merge, mergeBetween, mergeBetween, mergeBetween, mergeBetween, mergeBetween, mergeBetween, mergeBetween, mergeBetween, mergeBetween, mergeBetween, mergeFrom, mergeFrom, mergeFrom, mergeFrom, mergeFrom, mergeFrom, mergeFrom, mergeFrom, mergeFrom, mergeFrom, mergeTo, mergeTo, mergeTo, mergeTo, mergeTo, mergeTo, mergeTo, mergeTo, mergeTo, mergeTo, put, putArray, putArray, putArray, putArray, putArray, putArray, putArray, putArray, putArray, putArray, putArray, putArray, putValueAt, putValueAt, putValueAt, putValueAt, putValueAt, remove, remove, removeValueAt, removeValueAt, removeValueAt, removeValueAt, removeValueAt
-
Methods inherited from class org.refcodes.structure.PathMapBuilderImpl
clear, compute, computeIfAbsent, computeIfPresent, containsKey, containsValue, createBackingMap, entrySet, equals, forEach, get, getDelimiter, getOrDefault, getType, hashCode, isEmpty, keySet, merge, put, putAll, putIfAbsent, remove, remove, replace, replace, replaceAll, size, toDataStructure, toString, values
-
Methods inherited from interface org.refcodes.configuration.Properties
getDelimiter, getType, query, query, query, query, queryBetween, queryBetween, queryBetween, queryBetween, queryBetween, queryFrom, queryFrom, queryFrom, queryFrom, queryFrom, queryTo, queryTo, queryTo, queryTo, queryTo, retrieveBetween, retrieveBetween, retrieveBetween, retrieveBetween, retrieveBetween, retrieveFrom, retrieveFrom, retrieveFrom, retrieveFrom, retrieveFrom, retrieveTo, retrieveTo, retrieveTo, retrieveTo, retrieveTo
-
Methods inherited from interface org.refcodes.configuration.Properties.MutableProperties
containsValue, delete, delete, getDirAt, getDirAt, insert, insertBetween, insertFrom, insertTo, put, putAll, putAll, putAll, putDirAt, putDirAt, putDirAt, putDirAt, putDirAt, putDirAt, putDirAt, putDirAt, putDirAt, putDirAt, putDirAt, putDirAt, removeAll, removeAll, removeAll, removeAll, removeAll, removeDirAt, removeDirAt, removeDirAt, removeDirAt, removeDirAt, removeFrom, removeFrom, removeFrom, removeFrom, removePaths, removePaths
-
Methods inherited from interface org.refcodes.configuration.Properties.PropertiesBuilder
withInsert, withInsertBetween, withInsertBetween, withInsertBetween, withInsertBetween, withInsertBetween, withInsertBetween, withInsertBetween, withInsertBetween, withInsertBetween, withInsertFrom, withInsertFrom, withInsertFrom, withInsertFrom, withInsertFrom, withInsertFrom, withInsertFrom, withInsertFrom, withInsertFrom, withInsertTo, withInsertTo, withInsertTo, withInsertTo, withInsertTo, withInsertTo, withInsertTo, withInsertTo, withInsertTo, withPut, withPutBoolean, withPutBoolean, withPutByte, withPutByte, withPutDirAt, withPutDirAt, withPutDirAt, withPutDirAt, withPutDirAt, withPutDirAt, withPutDirAt, withPutDirAt, withPutDirAt, withPutDirAt, withPutDirAt, withPutDirAt, withPutDouble, withPutDouble, withPutFloat, withPutFloat, withPutInteger, withPutInteger, withPutLong, withPutLong, withPutShort, withPutShort, withRemoveFrom, withRemoveFrom, withRemoveFrom, withRemoveFrom
-
Methods inherited from interface org.refcodes.structure.PropertiesAccessorMixin
asArray, asArray, asArray, asArray, asBooleanArray, asBooleanArray, asBooleanArray, asBooleanArray, asByteArray, asByteArray, asByteArray, asByteArray, asCharacterArray, asCharacterArray, asCharacterArray, asCharacterArray, asDoubleArray, asDoubleArray, asDoubleArray, asDoubleArray, asFloatArray, asFloatArray, asFloatArray, asFloatArray, asIntegerArray, asIntegerArray, asIntegerArray, asIntegerArray, asLongArray, asLongArray, asLongArray, asLongArray, asShortArray, asShortArray, asShortArray, asShortArray, getBoolean, getBoolean, getBooleanOr, getBooleanOr, getByte, getByte, getByteOr, getByteOr, getCharacter, getCharacter, getCharacterOr, getCharacterOr, getDouble, getDouble, getDoubleOr, getDoubleOr, getFloat, getFloat, getFloatOr, getFloatOr, getInteger, getInteger, getIntegerOr, getIntegerOr, getLong, getLong, getLongOr, getLongOr, getShort, getShort, getShortOr, getShortOr
-
Methods inherited from interface org.refcodes.structure.PropertiesAccessorMixin.PropertiesBuilderMixin
withPut
-
Methods inherited from interface org.refcodes.structure.PropertiesAccessorMixin.PropertiesMutatorMixin
put, put, putBoolean, putBoolean, putByte, putByte, putDouble, putDouble, putFloat, putFloat, putInteger, putInteger, putLong, putLong, putShort, putShort
-
Methods inherited from class org.refcodes.configuration.PropertiesBuilderImpl
retrieveFrom, retrieveTo
-
Methods inherited from interface org.refcodes.configuration.ResourceProperties
toSerialized
-
Methods inherited from interface org.refcodes.configuration.ResourceProperties.MutableResoureProperties
fileTo, fileTo, fileTo, fileTo, fileTo, fileTo, fileTo, fileTo, loadFrom, loadFrom, loadFrom, loadFrom, loadFrom, loadFrom, loadFrom, loadFrom, parseFrom, parseFrom, saveTo, saveTo, saveTo, saveTo, saveTo, saveTo, saveTo, saveTo, saveTo, saveTo, seekFrom, seekFrom, seekFrom, seekFrom, seekFrom, seekFrom, seekFrom, seekFrom, toSerialized
-
Methods inherited from interface org.refcodes.configuration.ResourceProperties.ResourcePropertiesBuilder
withInsert, withInsertBetween, withInsertFrom, withInsertTo, withLoadFrom, withLoadFrom, withLoadFrom, withLoadFrom, withLoadFrom, withLoadFrom, withLoadFrom, withLoadFrom, withLoadFrom, withLoadFrom, withPut, withPut, withPut, withPut, withPut, withPutBoolean, withPutBoolean, withPutBoolean, withPutByte, withPutByte, withPutByte, withPutDouble, withPutDouble, withPutDouble, withPutFloat, withPutFloat, withPutFloat, withPutInteger, withPutInteger, withPutInteger, withPutLong, withPutLong, withPutLong, withPutShort, withPutShort, withPutShort, withRemoveFrom, withSeekFrom, withSeekFrom, withSeekFrom, withSeekFrom, withSeekFrom, withSeekFrom, withSeekFrom
-
-
-
-
Constructor Detail
-
AbstractResourcePropertiesBuilder
protected AbstractResourcePropertiesBuilder()
Create an emptyAbstractResourcePropertiesBuilder
instance using the default path delimiter "/" (Delimiter.PATH
) for the path declarations.
-
AbstractResourcePropertiesBuilder
protected AbstractResourcePropertiesBuilder(java.lang.Object aObj)
Create aAbstractResourcePropertiesBuilder
instance containing the elements as ofPathMap.MutablePathMap.insert(Object)
using the default path delimiter "/" (Delimiter.PATH
) for the path declarations: "Inspects the given object and adds all elements found in the given object. Elements of typeMap
,Collection
and arrays are identified and handled as of their type: The path for each value in aMap
is appended with its according key. The path for each value in aCollection
or array is appended with its according index of occurrence (in case of aList
or an array, its actual index). In case of reflection, the path for each member is appended with its according mamber's name. All elements (e.g. the members and values) are inspected recursively which results in the according paths of the terminating values."- Parameters:
aObj
- The object from which the elements are to be added.
-
AbstractResourcePropertiesBuilder
protected AbstractResourcePropertiesBuilder(Properties aProperties)
Create aAbstractResourcePropertiesBuilder
instance containing the elements of the providedProperties
instance using the default path delimiter "/" (Delimiter.PATH
) for the path declarations- Parameters:
aProperties
- the properties to be added.
-
AbstractResourcePropertiesBuilder
protected AbstractResourcePropertiesBuilder(Properties.PropertiesBuilder aProperties)
Create aAbstractResourcePropertiesBuilder
instance containing the elements of the providedProperties.PropertiesBuilder
instance using the default path delimiter "/" (Delimiter.PATH
) for the path declarations- Parameters:
aProperties
- the properties to be added.
-
AbstractResourcePropertiesBuilder
protected AbstractResourcePropertiesBuilder(java.util.Map<?,?> aProperties)
Create aAbstractResourcePropertiesBuilder
instance containing the elements of the providedMap
instance using the default path delimiter "/" (Delimiter.PATH
) for the path declarations- Parameters:
aProperties
- the properties to be added.
-
AbstractResourcePropertiesBuilder
protected AbstractResourcePropertiesBuilder(java.io.File aFile) throws java.io.IOException, java.text.ParseException
Loads the properties from the givenFile
.- Parameters:
aFile
- TheFile
from which to load the properties.- Throws:
java.io.IOException
- thrown in case accessing or processing the properties file failed.java.text.ParseException
- Signals that an error has been reached unexpectedly while parsing the data to be loaded.
-
AbstractResourcePropertiesBuilder
protected AbstractResourcePropertiesBuilder(java.io.File aFile, char... aDelimiters) throws java.io.IOException, java.text.ParseException
Loads the properties from the givenFile
.- Parameters:
aFile
- TheFile
from which to load the properties.aDelimiters
- The path delimiters to be used when parsing the source's properties.- Throws:
java.io.IOException
- thrown in case accessing or processing the properties file failed.java.text.ParseException
- Signals that an error has been reached unexpectedly while parsing the data to be loaded.
-
AbstractResourcePropertiesBuilder
protected AbstractResourcePropertiesBuilder(java.io.File aFile, org.refcodes.runtime.ConfigLocator aConfigLocator) throws java.io.IOException, java.text.ParseException
Loads or seeks the properties from the givenFile
. In case you enable the "seek" argument, then the properties are, if the file does not exist, loaded from the first folder containing such a file as of the specification for the methodConfigLocator.getFolders()
.- Parameters:
aFile
- TheFile
from which to load the properties.aConfigLocator
- TheConfigLocator
describes the locations to additional crawl for the desired file.- Throws:
java.io.IOException
- thrown in case accessing or processing the properties file failed.java.text.ParseException
- Signals that an error has been reached unexpectedly while parsing the data to be loaded.
-
AbstractResourcePropertiesBuilder
protected AbstractResourcePropertiesBuilder(java.io.File aFile, org.refcodes.runtime.ConfigLocator aConfigLocator, char... aDelimiters) throws java.io.IOException, java.text.ParseException
Loads or seeks the properties from the givenFile
. In case you enable the "seek" argument, then the properties are, if the file does not exist, loaded from the first folder containing such a file as of the specification for the methodConfigLocator.getFolders()
.- Parameters:
aFile
- TheFile
from which to load the properties.aConfigLocator
- TheConfigLocator
describes the locations to additional crawl for the desired file.aDelimiters
- The path delimiters to be used when parsing the source's properties.- Throws:
java.io.IOException
- thrown in case accessing or processing the properties file failed.java.text.ParseException
- Signals that an error has been reached unexpectedly while parsing the data to be loaded.
-
AbstractResourcePropertiesBuilder
public AbstractResourcePropertiesBuilder(java.lang.String aFilePath) throws java.io.IOException, java.text.ParseException
Loads the properties from the given file's path.- Parameters:
aFilePath
- The path to the file from which to load the properties.- Throws:
java.io.IOException
- thrown in case accessing or processing the properties file failed.java.text.ParseException
- Signals that an error has been reached unexpectedly while parsing the data to be loaded.
-
AbstractResourcePropertiesBuilder
protected AbstractResourcePropertiesBuilder(java.lang.String aFilePath, char... aDelimiters) throws java.io.IOException, java.text.ParseException
Loads the properties from the given file's path.- Parameters:
aFilePath
- The path to the file from which to load the properties.aDelimiters
- The path delimiters to be used when parsing the source's properties.- Throws:
java.io.IOException
- thrown in case accessing or processing the properties file failed.java.text.ParseException
- Signals that an error has been reached unexpectedly while parsing the data to be loaded.
-
AbstractResourcePropertiesBuilder
protected AbstractResourcePropertiesBuilder(java.lang.Class<?> aResourceClass, java.lang.String aFilePath) throws java.io.IOException, java.text.ParseException
Loads the properties from the given file's path.- Parameters:
aResourceClass
- The class which's class loader is to take care of loading the properties (from inside a JAR).aFilePath
- The file path of the class's resources from which to load the properties.- Throws:
java.io.IOException
- thrown in case accessing or processing the properties file failed.java.text.ParseException
- Signals that an error has been reached unexpectedly while parsing the data to be loaded.
-
AbstractResourcePropertiesBuilder
protected AbstractResourcePropertiesBuilder(java.lang.Class<?> aResourceClass, java.lang.String aFilePath, char... aDelimiters) throws java.io.IOException, java.text.ParseException
Loads the properties from the given file's path.- Parameters:
aResourceClass
- The class which's class loader is to take care of loading the properties (from inside a JAR).aFilePath
- The file path of the class's resources from which to load the properties.aDelimiters
- The path delimiters to be used when parsing the source's properties.- Throws:
java.io.IOException
- thrown in case accessing or processing the properties file failed.java.text.ParseException
- Signals that an error has been reached unexpectedly while parsing the data to be loaded.
-
AbstractResourcePropertiesBuilder
protected AbstractResourcePropertiesBuilder(java.lang.String aFilePath, org.refcodes.runtime.ConfigLocator aConfigLocator) throws java.io.IOException, java.text.ParseException
Loads the properties from the given file's path. In case you enable the "seek" argument, then the properties are, if the file does not exist, loaded from the first folder containing such a file as of the specification for the methodConfigLocator.getFolders()
.- Parameters:
aFilePath
- The path to the file from which to load the properties.aConfigLocator
- TheConfigLocator
describes the locations to additional crawl for the desired file.- Throws:
java.io.IOException
- thrown in case accessing or processing the properties file failed.java.text.ParseException
- Signals that an error has been reached unexpectedly while parsing the data to be loaded.
-
AbstractResourcePropertiesBuilder
protected AbstractResourcePropertiesBuilder(java.lang.String aFilePath, org.refcodes.runtime.ConfigLocator aConfigLocator, char... aDelimiters) throws java.io.IOException, java.text.ParseException
Loads the properties from the given file's path. In case you enable the "seek" argument, then the properties are, if the file does not exist, loaded from the first folder containing such a file as of the specification for the methodConfigLocator.getFolders()
.- Parameters:
aFilePath
- The path to the file from which to load the properties.aConfigLocator
- TheConfigLocator
describes the locations to additional crawl for the desired file.aDelimiters
- The path delimiters to be used when parsing the source's properties.- Throws:
java.io.IOException
- thrown in case accessing or processing the properties file failed.java.text.ParseException
- Signals that an error has been reached unexpectedly while parsing the data to be loaded.
-
AbstractResourcePropertiesBuilder
protected AbstractResourcePropertiesBuilder(java.lang.Class<?> aResourceClass, java.lang.String aFilePath, org.refcodes.runtime.ConfigLocator aConfigLocator) throws java.io.IOException, java.text.ParseException
Loads the properties from the given file's path. In case you enable the "seek" argument, then the properties are, if the file does not exist, loaded from the first folder containing such a file as of the specification for the methodConfigLocator.getFolders()
.- Parameters:
aResourceClass
- The class which's class loader is to take care of loading the properties (from inside a JAR).aFilePath
- The file path of the class's resources from which to load the properties.aConfigLocator
- TheConfigLocator
describes the locations to additional crawl for the desired file.- Throws:
java.io.IOException
- thrown in case accessing or processing the properties file failed.java.text.ParseException
- Signals that an error has been reached unexpectedly while parsing the data to be loaded.
-
AbstractResourcePropertiesBuilder
protected AbstractResourcePropertiesBuilder(java.lang.Class<?> aResourceClass, java.lang.String aFilePath, org.refcodes.runtime.ConfigLocator aConfigLocator, char... aDelimiters) throws java.io.IOException, java.text.ParseException
Loads the properties from the given file's path. In case you enable the "seek" argument, then the properties are, if the file does not exist, loaded from the first folder containing such a file as of the specification for the methodConfigLocator.getFolders()
.- Parameters:
aResourceClass
- The class which's class loader is to take care of loading the properties (from inside a JAR).aFilePath
- The file path of the class's resources from which to load the properties.aConfigLocator
- TheConfigLocator
describes the locations to additional crawl for the desired file.aDelimiters
- The path delimiters to be used when parsing the source's properties.- Throws:
java.io.IOException
- thrown in case accessing or processing the properties file failed.java.text.ParseException
- Signals that an error has been reached unexpectedly while parsing the data to be loaded.
-
AbstractResourcePropertiesBuilder
protected AbstractResourcePropertiesBuilder(java.net.URL aUrl) throws java.io.IOException, java.text.ParseException
Loads the properties from the givenURL
.- Parameters:
aUrl
- TheURL
from which to read the properties.- Throws:
java.io.IOException
- thrown in case accessing or processing the properties file failed.java.text.ParseException
- Signals that an error has been reached unexpectedly while parsing the data to be loaded.
-
AbstractResourcePropertiesBuilder
protected AbstractResourcePropertiesBuilder(java.net.URL aUrl, char... aDelimiters) throws java.io.IOException, java.text.ParseException
Loads the properties from the givenURL
.- Parameters:
aUrl
- TheURL
from which to read the properties.aDelimiters
- The path delimiters to be used when parsing the source's properties.- Throws:
java.io.IOException
- thrown in case accessing or processing the properties file failed.java.text.ParseException
- Signals that an error has been reached unexpectedly while parsing the data to be loaded.
-
AbstractResourcePropertiesBuilder
protected AbstractResourcePropertiesBuilder(java.io.InputStream aInputStream) throws java.io.IOException, java.text.ParseException
Reads the properties from the givenInputStream
.- Parameters:
aInputStream
- TheInputStream
from which to read the properties.- Throws:
java.io.IOException
- thrown in case accessing or processing the properties file failed.java.text.ParseException
- Signals that an error has been reached unexpectedly while parsing the data to be loaded.
-
AbstractResourcePropertiesBuilder
protected AbstractResourcePropertiesBuilder(java.io.InputStream aInputStream, char... aDelimiters) throws java.io.IOException, java.text.ParseException
Reads the properties from the givenInputStream
.- Parameters:
aInputStream
- TheInputStream
from which to read the properties.aDelimiters
- The path delimiters to be used when parsing the source's properties.- Throws:
java.io.IOException
- thrown in case accessing or processing the properties file failed.java.text.ParseException
- Signals that an error has been reached unexpectedly while parsing the data to be loaded.
-
-
Method Detail
-
loadFrom
public Properties loadFrom(java.io.InputStream aInputStream, char... aDelimiters) throws java.io.IOException, java.text.ParseException
Loads the properties from the givenInputStream
. Save them using the methodResourceProperties.MutableResoureProperties.saveTo(OutputStream)
. This is the hook-method of the default implementation for loading the properties. In case you want to implementResourceProperties
which support other notations than the properties notation (path=value
), then you overwrite this method in your implementation accordingly.- Specified by:
loadFrom
in interfaceResourceProperties.MutableResoureProperties
- Parameters:
aInputStream
- TheInputStream
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).- Returns:
- The
Properties
as loaded from the resource and applied to this instance. - Throws:
java.io.IOException
- thrown in case loading the properties failedjava.text.ParseException
- Signals that an error has been reached unexpectedly while parsing the data to be loaded.
-
saveTo
public void saveTo(java.io.OutputStream aOutputStream, java.lang.String aComment, char aDelimiter) throws java.io.IOException
The comment is ignored for the JSON format as JSON does not(!) support any comments! Saves the properties to the givenOutputStream
using the provided delimiter as the destination's path delimiter. Load them viaResourceProperties.MutableResoureProperties.loadFrom(InputStream, char...)
This is the hook-method of the default implementation for writing (saving) the properties. In case you want to implementResourceProperties
which support other notations than the properties notation (path=value
), then you overwrite this method in your implementation accordingly.- Specified by:
saveTo
in interfaceResourceProperties.MutableResoureProperties
- Parameters:
aOutputStream
- TheOutputStream
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).- Throws:
java.io.IOException
- thrown in case saving the properties failed
-
loadFrom
public Properties loadFrom(java.io.File aFile, char... aDelimiters) throws java.io.IOException, java.text.ParseException
Loads the properties from the givenFile
. Save them using the methodResourceProperties.MutableResoureProperties.saveTo(File)
. The default implementation uses the hook methodResourceProperties.MutableResoureProperties.loadFrom(InputStream, char...)
to finally load and parse the properties.- Specified by:
loadFrom
in interfaceResourceProperties.MutableResoureProperties
- Parameters:
aFile
- TheFile
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).- Returns:
- The
Properties
as loaded from the resource and applied to this instance. - Throws:
java.io.IOException
- thrown in case loading the properties failedjava.text.ParseException
- Signals that an error has been reached unexpectedly while parsing the data to be loaded.
-
saveTo
public java.io.File saveTo(java.io.File aFile, java.lang.String aComment, char aDelimiter) throws java.io.IOException
Saves the properties to the givenFile
using the provided delimiter as the destination's path delimiter. Load them viaResourceProperties.MutableResoureProperties.loadFrom(File, char...)
. The default implementation uses the hook methodResourceProperties.MutableResoureProperties.saveTo(OutputStream, String, char)
to finally format and write the properties.- Specified by:
saveTo
in interfaceResourceProperties.MutableResoureProperties
- Parameters:
aFile
- TheFile
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).- Returns:
- The
File
representing the actual location where the properties have been saved to. - Throws:
java.io.IOException
- thrown in case saving the properties failed
-
seekFrom
public Properties seekFrom(java.lang.Class<?> aResourceClass, java.lang.String aFilePath, org.refcodes.runtime.ConfigLocator aConfigLocator, char... aDelimiters) throws java.io.IOException, java.text.ParseException
Loads a properties file from the file path directly or (if not found) from the first folder containing such a file as of theConfigLocator
configuration passed. 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 methodResourceProperties.MutableResoureProperties.loadFrom(InputStream, char...)
to finally load and parse the properties.- Specified by:
seekFrom
in interfaceResourceProperties.MutableResoureProperties
- Parameters:
aResourceClass
- 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.aConfigLocator
- TheConfigLocator
describes the locations to additional crawl for the desired file.aDelimiters
- The path delimiters to be used when parsing the source's properties (in case the the serialized format supports / requires the such).- Returns:
- The
Properties
as loaded from the resource and applied to this instance. - Throws:
java.io.IOException
- thrown in case accessing or processing the properties file failed.java.text.ParseException
- Signals that an error has been reached unexpectedly while parsing the data to be loaded.
-
flush
public void flush() throws org.refcodes.component.OpenException
FlushesResourceProperties.MutableResoureProperties
to the resource to which theResourceProperties
are attached to (such as aFile
as ofResourceProperties.MutableResoureProperties.loadFrom(File)
orResourceProperties.MutableResoureProperties.saveTo(File)
).- Specified by:
flush
in interfacejava.io.Flushable
- Specified by:
flush
in interfaceorg.refcodes.component.Flushable
- Specified by:
flush
in interfaceResourceProperties.MutableResoureProperties
- Throws:
org.refcodes.component.OpenException
-
isFlushable
public boolean isFlushable()
In case the resource has not been loaded from a writableFile
, then calling this method will return false.- Specified by:
isFlushable
in interfaceorg.refcodes.component.Flushable
-
reload
public Properties reload() throws java.io.IOException, java.lang.IllegalStateException, java.text.ParseException
Reloads theResourceProperties
from the resource to which theResourceProperties
are attached to (such as aFile
as ofResourceProperties.MutableResoureProperties.loadFrom(File)
orResourceProperties.MutableResoureProperties.saveTo(File)
). In case the resource (such as anInputStream
) does not support reloading, then anIllegalStateException
is thrown. Properties existing in the attached resource as well in theProperties
itself are replaced. Properties existing in the attached resource but not(!) in theProperties
itself are not(!) removed. UseResourceProperties.reload(ReloadMode)
with an argument oftrue
(~ orphan removal) to remove properties not existing in the resource.- Specified by:
reload
in interfaceResourceProperties
- Returns:
- The
Properties
as loaded from the resource and applied to this instance. - Throws:
java.io.IOException
- thrown in case accessing the resource encountered an I/O problem.java.lang.IllegalStateException
- in case the attached resource does not support reloading.java.text.ParseException
- Signals that an error has been reached unexpectedly while parsing the data to be loaded.
-
reload
public Properties reload(ReloadMode aReloadMode) throws java.io.IOException, java.lang.IllegalStateException, java.text.ParseException
Reloads theResourceProperties
from the resource to which theResourceProperties
are attached to (such as aFile
as ofResourceProperties.MutableResoureProperties.loadFrom(File)
orResourceProperties.MutableResoureProperties.saveTo(File)
). In case the resource (such as anInputStream
) does not support reloading, then anIllegalStateException
is thrown. Properties existing in the attached resource as well in theProperties
itself are replaced. When "orphan removal" is set tofalse
, then properties existing in the attached resource but not(!) in theProperties
itself are not(!) removed. When "orphan removal" is set totrue
, then properties existing in the attached resource but not(!) in theProperties
itself are(!) removed.- Specified by:
reload
in interfaceResourceProperties
- Parameters:
aReloadMode
- when set toReloadMode.ORPHAN_REMOVAL
, then properties existing in the attached resource but not(!) in theProperties
itself are(!) removed. Else properties not existing in the attached resource are kept.- Returns:
- The
Properties
as loaded from the resource and applied to this instance. - Throws:
java.io.IOException
- thrown in case accessing the resource encountered an I/O problem.java.lang.IllegalStateException
- in case the attached resource does not support reloading.java.text.ParseException
- Signals that an error has been reached unexpectedly while parsing the data to be loaded.
-
createCanonicalMapFactory
protected abstract org.refcodes.structure.ext.factory.CanonicalMapFactory createCanonicalMapFactory()
Abstract method to be implemented by the sub-classes returning the concreteCanonicalMapFactory
responsible to fabricate theCanonicalMap
instances as of the required notation.- Returns:
- The
CanonicalMapFactory
supporting the required notation.
-
-