{"id":16538784,"url":"https://github.com/sbabcoc/settings","last_synced_at":"2026-02-19T03:06:04.639Z","repository":{"id":38016673,"uuid":"111161370","full_name":"sbabcoc/Settings","owner":"sbabcoc","description":"The SettingsCore class extends CompositeConfiguration, using the facilities provided by this class to produce an aggregated configuration.","archived":false,"fork":false,"pushed_at":"2023-02-05T04:10:41.000Z","size":133,"stargazers_count":2,"open_issues_count":1,"forks_count":1,"subscribers_count":5,"default_branch":"master","last_synced_at":"2023-09-22T06:45:05.081Z","etag":null,"topics":["apache-configuration","configuration","configuration-file","default-value","settings","system-properties"],"latest_commit_sha":null,"homepage":"","language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/sbabcoc.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-11-17T23:46:27.000Z","updated_at":"2022-05-13T00:57:52.000Z","dependencies_parsed_at":"2023-02-18T21:45:29.063Z","dependency_job_id":null,"html_url":"https://github.com/sbabcoc/Settings","commit_stats":null,"previous_names":[],"tags_count":29,"template":null,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sbabcoc%2FSettings","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sbabcoc%2FSettings/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sbabcoc%2FSettings/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sbabcoc%2FSettings/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/sbabcoc","download_url":"https://codeload.github.com/sbabcoc/Settings/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":219859479,"owners_count":16556036,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["apache-configuration","configuration","configuration-file","default-value","settings","system-properties"],"created_at":"2024-10-11T18:46:49.025Z","updated_at":"2025-10-11T15:15:15.953Z","avatar_url":"https://github.com/sbabcoc.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"[![Maven Central](https://img.shields.io/maven-central/v/com.nordstrom.tools/settings.svg)](https://mvnrepository.com/artifact/com.nordstrom.tools/settings)\r\n\r\n# SettingsCore\r\n\r\n### Composition of configurations\r\n\r\nThe **SettingsCore** class extends [CompositeConfiguration](https://commons.apache.org/proper/commons-configuration/apidocs/org/apache/commons/configuration2/CompositeConfiguration.html), using the facilities provided by this class to produce an aggregated configuration from three sources in the following order of precedence: \r\n\r\n1. System properties\r\n2. (optional) Stored properties, typically from a properties file\r\n3. (optional) Default values, typically specified in the enumeration\r\n\r\n### Declaring stored properties\r\n\r\nTo specify stored properties for your configuration, override one of following methods:\r\n\r\n* **`getStoredConfig`** - Your implementation returns a populated [Configuration](https://commons.apache.org/proper/commons-configuration/apidocs/org/apache/commons/configuration2/Configuration.html) object.\r\n* **`getInputStream`** - Your implementation returns an input stream supplying key/value pairs.\r\n* **`getSettingsUrl`** - Your implementation returns the URL from which to load your settings.\r\n* **`getSettingsPath`** - Your implementation returns the path from which to load your settings.\r\n\r\n\u003e **NOTE**: These methods are listed in order of evaluation, which stops at the first non-null response.  \r\n\u003e **NOTE**: Typical implementations override **`getSettingsPath`**, which will support most scenarios.  \r\n\u003e **NOTE**: Stored properties are declared in Apache's extended syntax. See [PropertiesConfiguration](https://commons.apache.org/proper/commons-configuration/apidocs/org/apache/commons/configuration2/PropertiesConfiguration.html) for details.  \r\n\u003e **NOTE**: By overriding the **`getStoredConfig`** method, you're able to incorporate any arbitrary [Configuration](https://commons.apache.org/proper/commons-configuration/apidocs/org/apache/commons/configuration2/Configuration.html) object you need into your settings - including another [CompositeConfiguration](https://commons.apache.org/proper/commons-configuration/apidocs/org/apache/commons/configuration2/CompositeConfiguration.html) object.\r\n\r\n### Specifying default values\r\n\r\nTwo methods have been provided for you to supply default values for your configuration:\r\n\r\n* Specify default values as arguments of the constant declarations in your settings enumeration and override the **`SettingsAPI.val`** method. Specifying _'null'_ for a setting's default value indicates that no default exists.\r\n* Alternatively, you can override the **`getDefaults`** method with your own implementation.\r\n\r\n\u003e **NOTE**: For settings collections with no default values, you can eliminate unnecessary processing in the core API by overriding **`getDefaults`** with a method that simply returns _'null'_.\r\n\r\nIt can be advantageous to create a hybrid of these two approaches - default values declared in the settings enumeration augmented by scenario-specific values produced by an override of the **`getDefaults`** method. You can see an example of this strategy in the [Selenium Foundation](https://github.com/sbabcoc/Selenium-Foundation) project. The settings defined in this project include default values that are specific to the target **Selenium** API version:\r\n\r\n* [Core Configuration](https://github.com/sbabcoc/Selenium-Foundation/blob/master/src/main/java/com/nordstrom/automation/selenium/AbstractSeleniumConfig.java#L498)\r\n* [Selenium 3 Specific](https://github.com/sbabcoc/Selenium-Foundation/blob/master/src/selenium3/java/com/nordstrom/automation/selenium/SeleniumConfig.java#L219)\r\n\r\n### Declaring configuration settings\r\n\r\nImplementations of **SettingsCore** supply a context-specific enumeration (which extends **Enum\u0026lt;T\u0026gt;**) to provide the collection of settings needed in this context. This enumeration must implement the **SettingsAPI** interface to provide clients with a common method for retrieving configuration keys and to give the core settings implementation access to the constants and default values of the enumeration.\r\n\r\n### Configuration examples\r\n\r\nFor example implementations of **SettingsCore**, check out this project's units tests. These demonstrate all of the major features of the API, including:\r\n\r\n* Declaration of settings and default values\r\n* Declaration and formatting of backing files\r\n* Extraction of typed data\r\n* Declaration of lists of values\r\n* Overrides of stored and default values\r\n* Configurable inclusion of sub-configurations\r\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsbabcoc%2Fsettings","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsbabcoc%2Fsettings","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsbabcoc%2Fsettings/lists"}