Package org.refcodes.configuration
Interface ResourceProperties
-
- All Superinterfaces:
org.refcodes.structure.CanonicalMap
,org.refcodes.structure.Containable
,org.refcodes.mixin.DelimiterAccessor
,org.refcodes.structure.Dictionary<java.lang.String,java.lang.String>
,org.refcodes.mixin.Dumpable
,org.refcodes.structure.Keys<java.lang.String,java.lang.String>
,org.refcodes.structure.PathMap<java.lang.String>
,Properties
,org.refcodes.structure.PropertiesAccessorMixin
,org.refcodes.mixin.TypeAccessor<java.lang.String>
- All Known Subinterfaces:
ResourceProperties.MutableResoureProperties
,ResourceProperties.ResourcePropertiesBuilder
,ScheduledResourceProperties
,ScheduledResourceProperties.ScheduledMuableResourceProperties
,ScheduledResourceProperties.ScheduledResourcePropertiesBuilder
- All Known Implementing Classes:
AbstractResourcePropertiesBuilder
,AbstractResourcePropertiesBuilderDecorator
,AbstractResourcePropertiesDecorator
,JavaProperties
,JavaPropertiesBuilder
,JsonProperties
,JsonPropertiesBuilder
,PolyglotProperties
,PolyglotPropertiesBuilder
,ScheduledResourcePropertiesBuilderDecorator
,ScheduledResourcePropertiesDecorator
,TomlProperties
,TomlPropertiesBuilder
,XmlProperties
,XmlPropertiesBuilder
,YamlProperties
,YamlPropertiesBuilder
public interface ResourceProperties extends Properties
TheResourceProperties
are a specialization of theDictionary
. Properties represent a collection ofString
key andString
value pairs as properties usually occur in pure text form, to be converted to the required data types. For this reason, theResourceProperties
interface provides additional conversion methods. When parsing properties from notations which do not support nodes to have values as well as child elements, then please support one of the identifiers contained in theVALUE_ATTRIBUTES
array.
-
-
Nested Class Summary
Nested Classes Modifier and Type Interface Description static interface
ResourceProperties.MutableResoureProperties
The interfaceResourceProperties.MutableResoureProperties
defines "dirty" methods allowing to modify ("mutate") theResourceProperties
.static interface
ResourceProperties.ResourcePropertiesBuilder
The interfaceResourceProperties.ResourcePropertiesBuilder
defines builder functionality on top of theResourceProperties.MutableResoureProperties
.-
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.Keys
org.refcodes.structure.Keys.MutableKeys<K extends java.lang.Object,V extends java.lang.Object>, org.refcodes.structure.Keys.MutableValues<K extends java.lang.Object,V extends java.lang.Object>
-
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
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.String[]
VALUE_ATTRIBUTES
The names specified in this array denote a key which's value is to be used for the parent's path's value when parsing a configuration file.-
Fields inherited from interface org.refcodes.configuration.Properties
DEFAULT_COMMENT
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description 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)
).-
Methods inherited from interface org.refcodes.structure.CanonicalMap
toInstance, toInstance, toType, toType
-
Methods inherited from interface org.refcodes.structure.Keys
containsKey, get, get, keySet, use, values
-
Methods inherited from interface org.refcodes.structure.PathMap
directories, directories, entries, entries, fromExternalKey, getArray, getArray, getRootPath, hasParentPath, isArray, isArray, isDirectory, isEntry, isRecord, isRootPath, keySet, paths, paths, records, records, toDataStructure, toDataStructure, toExternalKey, toMap, toNormalizedPath, toNormalizedPath, toParentPath, toPath
-
Methods inherited from interface org.refcodes.configuration.Properties
childrenOf, containsValue, getDelimiter, getType, retrieve, retrieveFrom, retrieveTo, toMap, toProperties, toPropertyPath
-
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
-
-
-
-
Field Detail
-
VALUE_ATTRIBUTES
static final java.lang.String[] VALUE_ATTRIBUTES
The names specified in this array denote a key which's value is to be used for the parent's path's value when parsing a configuration file. E.g. "yaml" files cannot have a value for a node which has sub-nodes, same applies to "json" and "xml" makes using the "mixed content" mechanism hard. Therefore when we require a value for a node (path) which may have sub-nodes (sub-paths), then e.g. a "this" node assigns a value to it's enclosing parent node.
-
-
Method Detail
-
reload
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. Usereload(ReloadMode)
with an argument oftrue
(~ orphan removal) to remove properties not existing in the resource.- 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
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.- 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.
-
-