Interface ImmutableResourcePropertiesFactory
- All Superinterfaces:
FilenameSuffixesAccessor
- All Known Subinterfaces:
ResourcePropertiesFactory
- All Known Implementing Classes:
JavaPropertiesFactory, JsonPropertiesFactory, PolyglotProperties.PolyglotPropertiesFactory, TomlPropertiesFactory, XmlPropertiesFactory, YamlPropertiesFactory
Factory interface for creating
ImmutableResourceProperties instances.-
Nested Class Summary
Nested classes/interfaces inherited from interface FilenameSuffixesAccessor
FilenameSuffixesAccessor.FilenameSuffixesBuilder<B>, FilenameSuffixesAccessor.FilenameSuffixesMutator, FilenameSuffixesAccessor.FilenameSuffixesProperty -
Method Summary
Modifier and TypeMethodDescriptiondefault booleanhasFilenameSuffix(File aFile) Determines whether this factory may be responsible for a given file.default booleanhasFilenameSuffix(String aFilePath) Determines whether this factory may be responsible for a given file.default ImmutableResourcePropertiestoProperties(File aFile) Loads the properties from the givenFile.toProperties(File aFile, ConfigLocator aConfigLocator) Loads or seeks the properties from the givenFile.toProperties(InputStream aInputStream) Reads the properties from the givenInputStream.default ImmutableResourcePropertiestoProperties(Class<?> aResourceClass, String aFilePath) Loads the properties from the given file's path.toProperties(Class<?> aResourceClass, String aFilePath, ConfigLocator aConfigLocator) Loads the properties from the given file's path.toProperties(Object aObj) Create aImmutableResourcePropertiesinstance containing the elements as ofImmutablePathTable.MutablePathTable.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.default ImmutableResourcePropertiestoProperties(String aFilePath) Loads the properties from the given file's path.default ImmutableResourcePropertiestoProperties(String aFilePath, ConfigLocator aConfigLocator) Loads the properties from the given file's path.toProperties(URL aUrl) Loads the properties from the givenURL.toProperties(Map<?, ?> aProperties) Create aImmutableResourcePropertiesinstance containing the elements of the providedMapinstance using the path delimiter "/" (Delimiter.PATH) for the path declarations.toProperties(ImmutableProperties aProperties) Create aImmutableResourcePropertiesinstance containing the elements of the providedImmutablePropertiesinstance using the path delimiter "/" (Delimiter.PATH) for the path declarations.toProperties(Properties aProperties) Create aImmutableResourcePropertiesinstance containing the elements of the providedPropertiesinstance using the default path delimiter "/" (Delimiter.PATH) for the path declarations.Methods inherited from interface FilenameSuffixesAccessor
getFilenameSuffixes
-
Method Details
-
hasFilenameSuffix
Determines whether this factory may be responsible for a given file.- Parameters:
aFile- The file which's suffix is to be tested.- Returns:
- True in case this factory may be responsible, else false.
-
hasFilenameSuffix
Determines whether this factory may be responsible for a given file.- Parameters:
aFilePath- The path of the file which's suffix is to be tested.- Returns:
- True in case this factory may be responsible, else false.
-
toProperties
default ImmutableResourceProperties toProperties(Class<?> aResourceClass, String aFilePath) throws IOException, 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.- Returns:
- The accordingly constructed
ImmutableResourceProperties. - 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
ImmutableResourceProperties toProperties(Class<?> aResourceClass, String aFilePath, ConfigLocator aConfigLocator) throws IOException, ParseException Loads the properties from the given file's path. A providedConfigLocatordescribes 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- TheConfigLocatordescribes the locations to additional crawl for the desired file.- Returns:
- The accordingly constructed
ImmutableResourceProperties. - 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
Loads the properties from the givenFile.- Parameters:
aFile- TheFilefrom which to load the properties.- Returns:
- The accordingly constructed
ImmutableResourceProperties. - 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
ImmutableResourceProperties toProperties(File aFile, ConfigLocator aConfigLocator) throws IOException, ParseException Loads or seeks the properties from the givenFile. A providedConfigLocatordescribes the locations to additional crawl for the desired file.- Parameters:
aFile- TheFilefrom which to load the properties.aConfigLocator- TheConfigLocatordescribes the locations to additional crawl for the desired file.- Returns:
- The accordingly constructed
ImmutableResourceProperties. - 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
ImmutableResourceProperties toProperties(InputStream aInputStream) throws IOException, ParseException Reads the properties from the givenInputStream.- Parameters:
aInputStream- TheInputStreamfrom which to read the properties.- Returns:
- The accordingly constructed
ImmutableResourceProperties. - 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 aImmutableResourcePropertiesinstance containing the elements of the providedMapinstance using the path delimiter "/" (Delimiter.PATH) for the path declarations.- Parameters:
aProperties- the properties to be added.- Returns:
- The accordingly constructed
ImmutableResourceProperties.
-
toProperties
Create aImmutableResourcePropertiesinstance containing the elements as ofImmutablePathTable.MutablePathTable.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,Collectionand arrays are identified and handled as of their type: The path for each value in aMapis appended with its according key. The path for each value in aCollectionor array is appended with its according index of occurrence (in case of aListor 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.- Returns:
- The accordingly constructed
ImmutableResourceProperties.
-
toProperties
Create aImmutableResourcePropertiesinstance containing the elements of the providedImmutablePropertiesinstance using the path delimiter "/" (Delimiter.PATH) for the path declarations.- Parameters:
aProperties- the properties to be added.- Returns:
- The accordingly constructed
ImmutableResourceProperties.
-
toProperties
Create aImmutableResourcePropertiesinstance containing the elements of the providedPropertiesinstance using the default path delimiter "/" (Delimiter.PATH) for the path declarations.- Parameters:
aProperties- the properties to be added.- Returns:
- The accordingly constructed
ImmutableResourceProperties.
-
toProperties
default ImmutableResourceProperties toProperties(String aFilePath) throws IOException, ParseException Loads the properties from the given file's path.- Parameters:
aFilePath- The path to the file from which to load the properties.- Returns:
- The accordingly constructed
ImmutableResourceProperties. - 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
default ImmutableResourceProperties toProperties(String aFilePath, ConfigLocator aConfigLocator) throws IOException, ParseException Loads the properties from the given file's path. A providedConfigLocatordescribes the locations to additional crawl for the desired file.- Parameters:
aFilePath- The path to the file from which to load the properties.aConfigLocator- TheConfigLocatordescribes the locations to additional crawl for the desired file.- Returns:
- The accordingly constructed
ImmutableResourceProperties. - 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
Loads the properties from the givenURL.- Parameters:
aUrl- TheURLfrom which to read the properties.- Returns:
- The accordingly constructed
ImmutableResourceProperties. - 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.
-