Module org.refcodes.properties
Package org.refcodes.properties
Class XmlPropertiesBuilder.XmlPropertiesBuilderFactory
java.lang.Object
org.refcodes.properties.XmlPropertiesBuilder.XmlPropertiesBuilderFactory
- All Implemented Interfaces:
org.refcodes.mixin.FilenameSuffixesAccessor
,ResourcePropertiesFactory
,ResourcePropertiesFactory.ResourcePropertiesBuilderFactory
- Enclosing class:
- XmlPropertiesBuilder
public static class XmlPropertiesBuilder.XmlPropertiesBuilderFactory
extends Object
implements ResourcePropertiesFactory.ResourcePropertiesBuilderFactory
The
XmlPropertiesBuilder.XmlPropertiesBuilderFactory
represents a
ResourcePropertiesFactory.ResourcePropertiesBuilderFactory
creating instances of type
XmlPropertiesBuilder
.-
Nested Class Summary
Nested classes/interfaces inherited from interface org.refcodes.mixin.FilenameSuffixesAccessor
org.refcodes.mixin.FilenameSuffixesAccessor.FilenameSuffixesBuilder<B extends org.refcodes.mixin.FilenameSuffixesAccessor.FilenameSuffixesBuilder<B>>, org.refcodes.mixin.FilenameSuffixesAccessor.FilenameSuffixesMutator, org.refcodes.mixin.FilenameSuffixesAccessor.FilenameSuffixesProperty
Nested classes/interfaces inherited from interface org.refcodes.properties.ResourcePropertiesFactory
ResourcePropertiesFactory.ResourcePropertiesBuilderFactory
-
Constructor Summary
ConstructorDescriptionConstructs anXmlCanonicalMapFactory
for creatingXmlPropertiesBuilder
instances.XmlPropertiesBuilderFactory
(boolean isXmlRootPreserve) Constructs anXmlCanonicalMapFactory
for creatingXmlPropertiesBuilder
instances. -
Method Summary
Modifier and TypeMethodDescriptionString[]
toProperties
(File aFile, org.refcodes.runtime.ConfigLocator aConfigLocator) Loads or seeks the properties from the givenFile
.toProperties
(InputStream aInputStream) Reads the properties from the givenInputStream
.toProperties
(Class<?> aResourceClass, String aFilePath, org.refcodes.runtime.ConfigLocator aConfigLocator) Loads the properties from the given file's path.toProperties
(Object aObj) Create aResourceProperties
instance containing the elements as ofPathMap.MutablePathMap.insert(Object)
using the path delimiter "/" (Delimiter.PATH
) for the path declarations: "Inspects the given object and adds all elements found in the given object.toProperties
(String aFilePath, org.refcodes.runtime.ConfigLocator aConfigLocator) Loads the properties from the given file's path.toProperties
(URL aUrl) Loads the properties from the givenURL
.toProperties
(Map<?, ?> aProperties) Create aResourceProperties
instance containing the elements of the providedMap
instance using the path delimiter "/" (Delimiter.PATH
) for the path declarations.toProperties
(Properties aProperties) Create aResourceProperties
instance containing the elements of the providedProperties
instance using the path delimiter "/" (Delimiter.PATH
) for the path declarations.toProperties
(Properties.PropertiesBuilder aProperties) Create aResourceProperties
instance containing the elements of the providedProperties.PropertiesBuilder
instance using the default path delimiter "/" (Delimiter.PATH
) for the path declarations.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.refcodes.properties.ResourcePropertiesFactory
hasFilenameSuffix, hasFilenameSuffix
Methods inherited from interface org.refcodes.properties.ResourcePropertiesFactory.ResourcePropertiesBuilderFactory
toProperties, toProperties, toProperties
-
Constructor Details
-
XmlPropertiesBuilderFactory
public XmlPropertiesBuilderFactory()Constructs anXmlCanonicalMapFactory
for creatingXmlPropertiesBuilder
instances. -
XmlPropertiesBuilderFactory
public XmlPropertiesBuilderFactory(boolean isXmlRootPreserve) Constructs anXmlCanonicalMapFactory
for creatingXmlPropertiesBuilder
instances.- Parameters:
isXmlRootPreserve
- When set totrue
then unmarshaling (XML) documents will preserve the root element. As an (XML) document requires a root element, the root element often is provided merely as of syntactic reasons and must be omitted as of semantic reasons. Unmarshaling functionality therefore by default skips the root elelemt, as this is considered merely to serve as an envelope. This behavior can be overridden by setting this property totrue
.
-
-
Method Details
-
getFilenameSuffixes
- Specified by:
getFilenameSuffixes
in interfaceorg.refcodes.mixin.FilenameSuffixesAccessor
-
toProperties
public ResourceProperties.ResourcePropertiesBuilder toProperties(Class<?> aResourceClass, String aFilePath, org.refcodes.runtime.ConfigLocator aConfigLocator) throws IOException, ParseException Loads the 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).- Specified by:
toProperties
in interfaceResourcePropertiesFactory
- Specified by:
toProperties
in interfaceResourcePropertiesFactory.ResourcePropertiesBuilderFactory
- 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.- Returns:
- The accordingly constructed
ResourceProperties
. - Throws:
IOException
- thrown in case accessing or processing the properties file failed.ParseException
- Signals that an error has been reached unexpectedly while parsing the data to be loaded.
-
toProperties
public ResourceProperties.ResourcePropertiesBuilder toProperties(File aFile, org.refcodes.runtime.ConfigLocator aConfigLocator) throws IOException, ParseException Loads or seeks the properties from the givenFile
. A providedConfigLocator
describes the locations to additional crawl for the desired file.- Specified by:
toProperties
in interfaceResourcePropertiesFactory
- Specified by:
toProperties
in interfaceResourcePropertiesFactory.ResourcePropertiesBuilderFactory
- Parameters:
aFile
- TheFile
from which to load the properties.aConfigLocator
- TheConfigLocator
describes the locations to additional crawl for the desired file.- Returns:
- The accordingly constructed
ResourceProperties
. - Throws:
IOException
- thrown in case accessing or processing the properties file failed.ParseException
- Signals that an error has been reached unexpectedly while parsing the data to be loaded.
-
toProperties
public ResourceProperties.ResourcePropertiesBuilder toProperties(InputStream aInputStream) throws IOException, ParseException Reads the properties from the givenInputStream
.- Specified by:
toProperties
in interfaceResourcePropertiesFactory
- Specified by:
toProperties
in interfaceResourcePropertiesFactory.ResourcePropertiesBuilderFactory
- Parameters:
aInputStream
- TheInputStream
from which to read the properties.- Returns:
- The accordingly constructed
ResourceProperties
. - Throws:
IOException
- thrown in case accessing or processing the properties file failed.ParseException
- Signals that an error has been reached unexpectedly while parsing the data to be loaded.
-
toProperties
Create aResourceProperties
instance containing the elements of the providedMap
instance using the path delimiter "/" (Delimiter.PATH
) for the path declarations.- Specified by:
toProperties
in interfaceResourcePropertiesFactory
- Specified by:
toProperties
in interfaceResourcePropertiesFactory.ResourcePropertiesBuilderFactory
- Parameters:
aProperties
- the properties to be added.- Returns:
- The accordingly constructed
ResourceProperties
.
-
toProperties
Create aResourceProperties
instance containing the elements as ofPathMap.MutablePathMap.insert(Object)
using the 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."- Specified by:
toProperties
in interfaceResourcePropertiesFactory
- Specified by:
toProperties
in interfaceResourcePropertiesFactory.ResourcePropertiesBuilderFactory
- Parameters:
aObj
- The object from which the elements are to be added.- Returns:
- The accordingly constructed
ResourceProperties
.
-
toProperties
Create aResourceProperties
instance containing the elements of the providedProperties
instance using the path delimiter "/" (Delimiter.PATH
) for the path declarations.- Specified by:
toProperties
in interfaceResourcePropertiesFactory
- Specified by:
toProperties
in interfaceResourcePropertiesFactory.ResourcePropertiesBuilderFactory
- Parameters:
aProperties
- the properties to be added.- Returns:
- The accordingly constructed
ResourceProperties
.
-
toProperties
public ResourceProperties.ResourcePropertiesBuilder toProperties(Properties.PropertiesBuilder aProperties) Create aResourceProperties
instance containing the elements of the providedProperties.PropertiesBuilder
instance using the default path delimiter "/" (Delimiter.PATH
) for the path declarations.- Specified by:
toProperties
in interfaceResourcePropertiesFactory
- Specified by:
toProperties
in interfaceResourcePropertiesFactory.ResourcePropertiesBuilderFactory
- Parameters:
aProperties
- the properties to be added.- Returns:
- The accordingly constructed
ResourceProperties
.
-
toProperties
public ResourceProperties.ResourcePropertiesBuilder toProperties(String aFilePath, org.refcodes.runtime.ConfigLocator aConfigLocator) throws IOException, ParseException Loads the properties from the given file's path. A providedConfigLocator
describes the locations to additional crawl for the desired file.- Specified by:
toProperties
in interfaceResourcePropertiesFactory
- Specified by:
toProperties
in interfaceResourcePropertiesFactory.ResourcePropertiesBuilderFactory
- 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.- Returns:
- The accordingly constructed
ResourceProperties
. - Throws:
IOException
- thrown in case accessing or processing the properties file failed.ParseException
- Signals that an error has been reached unexpectedly while parsing the data to be loaded.
-
toProperties
public ResourceProperties.ResourcePropertiesBuilder toProperties(URL aUrl) throws IOException, ParseException Loads the properties from the givenURL
.- Specified by:
toProperties
in interfaceResourcePropertiesFactory
- Specified by:
toProperties
in interfaceResourcePropertiesFactory.ResourcePropertiesBuilderFactory
- Parameters:
aUrl
- TheURL
from which to read the properties.- Returns:
- The accordingly constructed
ResourceProperties
. - Throws:
IOException
- thrown in case accessing or processing the properties file failed.ParseException
- Signals that an error has been reached unexpectedly while parsing the data to be loaded.
-