public class NormalizedPropertiesDecorator extends AbstractPropertiesDecorator<Properties> implements Properties
NormalizedPropertiesDecorator
type decorates a Properties
instance and converts a path delimiter such as the full-stop (".") to the
Properties
properties' path delimiter slash ("/", as of
AbstractPropertiesDecorator.getDelimiter()
). E.g. you get a projection of your
Properties
using "." as the path delimiter as if them had a "/" as
path delimiter.
Invoking NormalizedPropertiesDecorator(Properties, char[])
the
constructor, you can define the delimiters to be projected to the default "/"
delimiter (as of AbstractPropertiesDecorator.getDelimiter()
).
Upon accessing a key, the implementation first tests whether the decorated
(underlying) Properties
contain this key, then the decorated
(underlying) Properties
' keys are tested by converting the keys using
the first provided delimiter to be replaced by the "/" delimiter". If we have
a match, then this property is processed, else the procedure continues with
the next delimiter. This means that the first match wins, if we have
succeeding matches with succeeding delimiters then an
AmbigousKeyRuntimeException
is thrown
In case of accessing the keySet()
, all keys are converted by
replacing all the provided delimiters (or the full-stop ("."), depending on
the constructor you called) to the default delimiter "/". In case we have a
key collision then an AmbigousKeyRuntimeException
is thrown.Properties.MutableProperties, Properties.PropertiesBuilder
org.refcodes.structure.CanonicalMap.CanonicalMapBuilder, org.refcodes.structure.CanonicalMap.MutableCanonicalMap
org.refcodes.structure.PathMap.MutablePathMap<T>, org.refcodes.structure.PathMap.PathMapBuilder<T>
org.refcodes.structure.Dictionary.MutableDictionary<K,V>
org.refcodes.structure.Keys.MutableKeys<K,V>, org.refcodes.structure.Keys.MutableValues<K,V>
org.refcodes.mixin.DelimiterAccessor.DelimiterBuilder<B extends org.refcodes.mixin.DelimiterAccessor.DelimiterBuilder<B>>, org.refcodes.mixin.DelimiterAccessor.DelimiterMutator, org.refcodes.mixin.DelimiterAccessor.DelimiterProperty
org.refcodes.mixin.TypeAccessor.TypeMutator<T>, org.refcodes.mixin.TypeAccessor.TypeProperty<T>
org.refcodes.structure.PropertiesAccessorMixin.PropertiesBuilderMixin<T>, org.refcodes.structure.PropertiesAccessorMixin.PropertiesMixin, org.refcodes.structure.PropertiesAccessorMixin.PropertiesMutatorMixin
_properties
DEFAULT_COMMENT
Constructor and Description |
---|
NormalizedPropertiesDecorator(Properties aProperties)
Decorates the provided
Properties with additional behavior by
normalizing the key representing the path pointing to the according
value. |
NormalizedPropertiesDecorator(Properties aProperties,
char[] aDelimiters)
Decorates the provided
Properties with additional behavior by
normalizing the key representing the path pointing to the according
value. |
Modifier and Type | Method and Description |
---|---|
Properties |
childrenOf(String aParentPath) |
boolean |
containsKey(Object aKey) |
protected static String |
fromNormalized(String aKey,
char aFromDelimiter,
char aToDelimiter) |
String |
get(Object aKey) |
Set<String> |
keySet() |
Properties |
retrieveFrom(String aFromPath) |
Properties |
retrieveTo(String aToPath) |
protected String |
toDelimiters() |
protected static String |
toNormalized(String aKey,
char aToDelimiter,
char... aFromDelimiters) |
getDelimiter, isEmpty, size, toDataStructure, values
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
containsValue, getType, retrieve, 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, toPath, 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
public NormalizedPropertiesDecorator(Properties aProperties)
Properties
with additional behavior by
normalizing the key representing the path pointing to the according
value.
You provide Properties
with a path delimiter different from the
default delimiter and you get Properties
which act as if the
delimiter was the default delimiter:
Paths containing the namespace delimiter "." (as of
Delimiter.NAMESPACE
are converted to paths' with delimiter "/"
(as of Delimiter.PATH
.
Changes applied to the provided Properties
affect the decorator.aProperties
- The Properties
to be decorated.public NormalizedPropertiesDecorator(Properties aProperties, char[] aDelimiters)
Properties
with additional behavior by
normalizing the key representing the path pointing to the according
value.
You provide Properties
with a path delimiter different from the
default delimiter and you get Properties
which act as if the
delimiter was the default delimiter:
Paths containing the provided delimiters are converted to the paths' with
delimiter "/" (as of Delimiter.PATH
.
Changes applied to the provided Properties
affect the decorator.aProperties
- The Properties
to be decorated.aDelimiters
- The delimiters to be converted forth and backpublic boolean containsKey(Object aKey)
containsKey
in interface org.refcodes.structure.Keys<String,String>
containsKey
in class AbstractPropertiesDecorator<Properties>
public String get(Object aKey)
get
in interface org.refcodes.structure.Keys<String,String>
get
in class AbstractPropertiesDecorator<Properties>
public Set<String> keySet()
keySet
in interface org.refcodes.structure.Keys<String,String>
keySet
in class AbstractPropertiesDecorator<Properties>
public Properties retrieveFrom(String aFromPath)
retrieveFrom
in interface Properties
retrieveFrom
in interface org.refcodes.structure.CanonicalMap
retrieveFrom
in interface org.refcodes.structure.PathMap<String>
retrieveFrom
in class AbstractPropertiesDecorator<Properties>
public Properties retrieveTo(String aToPath)
retrieveTo
in interface Properties
retrieveTo
in interface org.refcodes.structure.CanonicalMap
retrieveTo
in interface org.refcodes.structure.PathMap<String>
retrieveTo
in class AbstractPropertiesDecorator<Properties>
public Properties childrenOf(String aParentPath)
childrenOf
in interface Properties
childrenOf
in interface org.refcodes.structure.CanonicalMap
childrenOf
in interface org.refcodes.structure.PathMap<String>
childrenOf
in class AbstractPropertiesDecorator<Properties>
protected String toDelimiters()
protected static String fromNormalized(String aKey, char aFromDelimiter, char aToDelimiter)
Copyright © 2018. All rights reserved.