Package org.refcodes.configuration
Class JsonPropertiesBuilder
- java.lang.Object
-
- java.util.AbstractMap<K,V>
-
- java.util.HashMap<java.lang.String,T>
-
- org.refcodes.structure.PathMapBuilderImpl<java.lang.String>
-
- org.refcodes.configuration.PropertiesBuilderImpl
-
- org.refcodes.configuration.AbstractResourcePropertiesBuilder
-
- org.refcodes.configuration.JsonPropertiesBuilder
-
- All Implemented Interfaces:
java.io.Flushable
,java.io.Serializable
,java.lang.Cloneable
,java.util.Map<java.lang.String,java.lang.String>
,org.refcodes.component.Flushable
,org.refcodes.component.Flushable.FlushBuilder<ResourceProperties.ResourcePropertiesBuilder>
,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,java.lang.String>
,org.refcodes.structure.Dictionary.MutableDictionary<java.lang.String,java.lang.String>
,org.refcodes.structure.Dictionary.MutableDictionary.DictionaryBuilder<java.lang.String,java.lang.String,org.refcodes.structure.PathMap.PathMapBuilder<java.lang.String>>
,org.refcodes.structure.Keys<java.lang.String,java.lang.String>
,org.refcodes.structure.Keys.MutableKeys<java.lang.String,java.lang.String>
,org.refcodes.structure.Keys.MutableValues<java.lang.String,java.lang.String>
,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<org.refcodes.structure.CanonicalMap.CanonicalMapBuilder>
,org.refcodes.structure.PropertiesAccessorMixin.PropertiesMixin
,org.refcodes.structure.PropertiesAccessorMixin.PropertiesMutatorMixin
public class JsonPropertiesBuilder extends AbstractResourcePropertiesBuilder implements ResourceProperties.ResourcePropertiesBuilder
Implementation of theResourceProperties.ResourcePropertiesBuilder
interface with support of so called "JSON properties" (or just "properties"). For JSON, see "https://en.wikipedia.org/wiki/JSON".- See Also:
- Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
JsonPropertiesBuilder.JsonPropertiesBuilderFactory
TheJsonPropertiesBuilder.JsonPropertiesBuilderFactory
represents aResourcePropertiesFactory.ResourcePropertiesBuilderFactory
creating instances of typeJsonPropertiesBuilder
.-
Nested classes/interfaces inherited from class java.util.AbstractMap
java.util.AbstractMap.SimpleEntry<K extends java.lang.Object,V extends java.lang.Object>, java.util.AbstractMap.SimpleImmutableEntry<K extends java.lang.Object,V extends java.lang.Object>
-
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 inherited from class org.refcodes.configuration.AbstractResourcePropertiesBuilder
_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 Constructor Description JsonPropertiesBuilder()
Create an emptyJsonPropertiesBuilder
instance using the default path delimiter "/" (Delimiter.PATH
) for the path declarations.JsonPropertiesBuilder(java.io.File aFile)
Loads the JSON properties from the givenFile
.JsonPropertiesBuilder(java.io.File aFile, char... aDelimiters)
Loads the JSON properties from the givenFile
.JsonPropertiesBuilder(java.io.File aFile, org.refcodes.runtime.ConfigLocator aConfigLocator)
Loads or seeks the JSON properties from the givenFile
.JsonPropertiesBuilder(java.io.File aFile, org.refcodes.runtime.ConfigLocator aConfigLocator, char... aDelimiters)
Loads or seeks the JSON properties from the givenFile
.JsonPropertiesBuilder(java.io.InputStream aInputStream)
Reads the JSON properties from the givenInputStream
.JsonPropertiesBuilder(java.io.InputStream aInputStream, char... aDelimiters)
Reads the JSON properties from the givenInputStream
.JsonPropertiesBuilder(java.lang.Class<?> aResourceClass, java.lang.String aFilePath)
Loads the JSON properties from the given file's path.JsonPropertiesBuilder(java.lang.Class<?> aResourceClass, java.lang.String aFilePath, char... aDelimiters)
Loads the JSON properties from the given file's path.JsonPropertiesBuilder(java.lang.Class<?> aResourceClass, java.lang.String aFilePath, org.refcodes.runtime.ConfigLocator aConfigLocator)
Loads the JSON properties from the given file's path.JsonPropertiesBuilder(java.lang.Class<?> aResourceClass, java.lang.String aFilePath, org.refcodes.runtime.ConfigLocator aConfigLocator, char... aDelimiters)
Loads the JSON properties from the given file's path.JsonPropertiesBuilder(java.lang.Object aObj)
Create aJsonPropertiesBuilder
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.JsonPropertiesBuilder(java.lang.String aFilePath)
Loads the JSON properties from the given file's path.JsonPropertiesBuilder(java.lang.String aFilePath, char... aDelimiters)
Loads the JSON properties from the given file's path.JsonPropertiesBuilder(java.lang.String aFilePath, org.refcodes.runtime.ConfigLocator aConfigLocator)
Loads the JSON properties from the given file's path.JsonPropertiesBuilder(java.lang.String aFilePath, org.refcodes.runtime.ConfigLocator aConfigLocator, char... aDelimiters)
Loads the JSON properties from the given file's path.JsonPropertiesBuilder(java.net.URL aUrl)
Loads the JSON properties from the givenURL
.JsonPropertiesBuilder(java.net.URL aUrl, char... aDelimiters)
Loads the JSON properties from the givenURL
.JsonPropertiesBuilder(java.util.Map<?,?> aProperties)
Create aJsonPropertiesBuilder
instance containing the elements of the providedMap
instance using the default path delimiter "/" (Delimiter.PATH
) for the path declarationsJsonPropertiesBuilder(Properties aProperties)
Create aJsonPropertiesBuilder
instance containing the elements of the providedProperties
instance using the default path delimiter "/" (Delimiter.PATH
) for the path declarationsJsonPropertiesBuilder(Properties.PropertiesBuilder aProperties)
Create aJsonPropertiesBuilder
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 Concrete Methods Modifier and Type Method Description Properties
loadFrom(java.io.InputStream aInputStream, char... aDelimiters)
Loads the properties from the givenInputStream
.void
saveTo(java.io.OutputStream aOutputStream, java.lang.String aComment, char aDelimiter)
The comment is ignored for the JSON format as JSON does not(!)-
Methods inherited from class org.refcodes.configuration.AbstractResourcePropertiesBuilder
flush, isFlushable, loadFrom, postProcessAttributes, reload, reload, saveTo, seekFrom
-
Methods inherited from interface org.refcodes.structure.CanonicalMap
toInstance, toInstance, toType, toType
-
Methods inherited from interface org.refcodes.structure.CanonicalMap.CanonicalMapBuilder
withInsert, withInsert, withInsertFrom, withInsertTo
-
Methods inherited from interface org.refcodes.structure.CanonicalMap.MutableCanonicalMap
insert, insert, insertFrom, insertTo, putAll, toDump, toSourceCode, toSourceCode
-
Methods inherited from interface org.refcodes.component.Flushable.FlushBuilder
withFlush, withFlushUnchecked
-
Methods inherited from class java.util.HashMap
clear, clone, containsValue, entrySet, forEach, isEmpty, keySet, putAll, replaceAll, size, values
-
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface org.refcodes.structure.PathMap
directories, directories, entries, entries, fromExternalKey, get, get, getArray, getArray, getIndexes, getIndexes, getRootPath, hasIndexed, hasIndexed, hasParentPath, isArray, isArray, isDirectory, isEntry, isIndexed, isIndexed, isPath, isRecord, isRootPath, keySet, paths, paths, records, records, toDataStructure, toDataStructure, toExternalKey, toMap, toNormalizedPath, toNormalizedPath, toParentPath, toPath, toPath
-
Methods inherited from interface org.refcodes.structure.PathMap.MutablePathMap
insert, insert, insert, insert, insertFrom, insertFrom, insertTo, insertTo, put, putArray, putArray, remove, remove, removeAll, removeAll, removeAll, removeAll
-
Methods inherited from interface org.refcodes.structure.PathMap.PathMapBuilder
withInsert, withInsert, withInsertFrom, withInsertTo
-
Methods inherited from class org.refcodes.structure.PathMapBuilderImpl
compute, computeIfAbsent, computeIfPresent, containsKey, get, getDelimiter, getOrDefault, getType, merge, put, putIfAbsent, remove, remove, replace, replace, toDataStructure
-
Methods inherited from interface org.refcodes.configuration.Properties
getDelimiter, getType, toMap, toProperties, toPropertyPath
-
Methods inherited from interface org.refcodes.configuration.Properties.MutableProperties
containsValue, delete, delete, insert, insert, insertFrom, insertTo, put, putAll, putAll, putAll
-
Methods inherited from interface org.refcodes.configuration.Properties.PropertiesBuilder
childrenOf, getIndexed, getIndexed, retrieve, retrieveFrom, retrieveTo, withInsert, withInsert, withInsertFrom, withInsertTo
-
Methods inherited from interface org.refcodes.structure.PropertiesAccessorMixin
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
-
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
childrenOf, retrieveFrom, retrieveTo
-
Methods inherited from interface org.refcodes.configuration.ResourceProperties
reload, reload
-
Methods inherited from interface org.refcodes.configuration.ResourceProperties.MutableResoureProperties
fileTo, fileTo, fileTo, fileTo, fileTo, fileTo, fileTo, fileTo, flush, loadFrom, loadFrom, loadFrom, loadFrom, loadFrom, loadFrom, loadFrom, loadFrom, loadFrom, parseFrom, parseFrom, saveTo, saveTo, saveTo, saveTo, saveTo, saveTo, saveTo, saveTo, saveTo, saveTo, saveTo, seekFrom, seekFrom, seekFrom, seekFrom, seekFrom, seekFrom, seekFrom, seekFrom, seekFrom, toSerialized, toSerialized
-
Methods inherited from interface org.refcodes.configuration.ResourceProperties.ResourcePropertiesBuilder
withInsert, 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, withSeekFrom, withSeekFrom
-
-
-
-
Constructor Detail
-
JsonPropertiesBuilder
public JsonPropertiesBuilder()
Create an emptyJsonPropertiesBuilder
instance using the default path delimiter "/" (Delimiter.PATH
) for the path declarations.
-
JsonPropertiesBuilder
public JsonPropertiesBuilder(java.lang.Object aObj)
Create aJsonPropertiesBuilder
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.
-
JsonPropertiesBuilder
public JsonPropertiesBuilder(Properties aProperties)
Create aJsonPropertiesBuilder
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.
-
JsonPropertiesBuilder
public JsonPropertiesBuilder(Properties.PropertiesBuilder aProperties)
Create aJsonPropertiesBuilder
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.
-
JsonPropertiesBuilder
public JsonPropertiesBuilder(java.util.Map<?,?> aProperties)
Create aJsonPropertiesBuilder
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.
-
JsonPropertiesBuilder
public JsonPropertiesBuilder(java.io.File aFile) throws java.io.IOException, java.text.ParseException
Loads the JSON 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.
-
JsonPropertiesBuilder
public JsonPropertiesBuilder(java.io.File aFile, char... aDelimiters) throws java.io.IOException, java.text.ParseException
Loads the JSON 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.
-
JsonPropertiesBuilder
public JsonPropertiesBuilder(java.io.File aFile, org.refcodes.runtime.ConfigLocator aConfigLocator) throws java.io.IOException, java.text.ParseException
Loads or seeks the JSON properties from the givenFile
. A providedConfigLocator
describes the locations to additional crawl for the desired file.- 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.
-
JsonPropertiesBuilder
public JsonPropertiesBuilder(java.io.File aFile, org.refcodes.runtime.ConfigLocator aConfigLocator, char... aDelimiters) throws java.io.IOException, java.text.ParseException
Loads or seeks the JSON properties from the givenFile
. A providedConfigLocator
describes the locations to additional crawl for the desired file.- 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.
-
JsonPropertiesBuilder
public JsonPropertiesBuilder(java.lang.String aFilePath) throws java.io.IOException, java.text.ParseException
Loads the JSON 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.
-
JsonPropertiesBuilder
public JsonPropertiesBuilder(java.lang.String aFilePath, char... aDelimiters) throws java.io.IOException, java.text.ParseException
Loads the JSON 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.
-
JsonPropertiesBuilder
public JsonPropertiesBuilder(java.lang.Class<?> aResourceClass, java.lang.String aFilePath) throws java.io.IOException, java.text.ParseException
Loads the JSON 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.
-
JsonPropertiesBuilder
public JsonPropertiesBuilder(java.lang.Class<?> aResourceClass, java.lang.String aFilePath, char... aDelimiters) throws java.io.IOException, java.text.ParseException
Loads the JSON 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.
-
JsonPropertiesBuilder
public JsonPropertiesBuilder(java.lang.String aFilePath, org.refcodes.runtime.ConfigLocator aConfigLocator) throws java.io.IOException, java.text.ParseException
Loads the JSON properties from the given file's path. A providedConfigLocator
describes the locations to additional crawl for the desired file.- 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.
-
JsonPropertiesBuilder
public JsonPropertiesBuilder(java.lang.String aFilePath, org.refcodes.runtime.ConfigLocator aConfigLocator, char... aDelimiters) throws java.io.IOException, java.text.ParseException
Loads the JSON properties from the given file's path. A providedConfigLocator
describes the locations to additional crawl for the desired file.- 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.
-
JsonPropertiesBuilder
public JsonPropertiesBuilder(java.lang.Class<?> aResourceClass, java.lang.String aFilePath, org.refcodes.runtime.ConfigLocator aConfigLocator) throws java.io.IOException, java.text.ParseException
Loads the JSON properties from the given file's path. A providedConfigLocator
describes the locations to additional crawl for the desired file. 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).- 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.
-
JsonPropertiesBuilder
public JsonPropertiesBuilder(java.lang.Class<?> aResourceClass, java.lang.String aFilePath, org.refcodes.runtime.ConfigLocator aConfigLocator, char... aDelimiters) throws java.io.IOException, java.text.ParseException
Loads the JSON properties from the given file's path. A providedConfigLocator
describes the locations to additional crawl for the desired file. 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). *- 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.
-
JsonPropertiesBuilder
public JsonPropertiesBuilder(java.net.URL aUrl) throws java.io.IOException, java.text.ParseException
Loads the JSON 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.
-
JsonPropertiesBuilder
public JsonPropertiesBuilder(java.net.URL aUrl, char... aDelimiters) throws java.io.IOException, java.text.ParseException
Loads the JSON 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.
-
JsonPropertiesBuilder
public JsonPropertiesBuilder(java.io.InputStream aInputStream) throws java.io.IOException, java.text.ParseException
Reads the JSON 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.
-
JsonPropertiesBuilder
public JsonPropertiesBuilder(java.io.InputStream aInputStream, char... aDelimiters) throws java.io.IOException, java.text.ParseException
Reads the JSON 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
-
-