{"id":19788324,"url":"https://github.com/graylog2/jadconfig","last_synced_at":"2025-04-04T10:05:23.809Z","repository":{"id":38375367,"uuid":"2297743","full_name":"Graylog2/JadConfig","owner":"Graylog2","description":"Annotation-driven configuration library for the Java programming language","archived":false,"fork":false,"pushed_at":"2025-02-07T14:01:33.000Z","size":3311,"stargazers_count":23,"open_issues_count":12,"forks_count":12,"subscribers_count":14,"default_branch":"main","last_synced_at":"2025-04-04T09:42:01.995Z","etag":null,"topics":["configuration","google-guava","google-guice","guava","guice","java","java-library","joda"],"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/Graylog2.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2011-08-30T21:08:38.000Z","updated_at":"2025-02-05T14:18:34.000Z","dependencies_parsed_at":"2024-06-10T09:28:21.982Z","dependency_job_id":"42ef38bb-c647-47cc-bb4b-6c13d40b29b9","html_url":"https://github.com/Graylog2/JadConfig","commit_stats":{"total_commits":269,"total_committers":9,"mean_commits":29.88888888888889,"dds":0.2825278810408922,"last_synced_commit":"18c9f0368b6abc2d32e083ebc5b5fe76138f46f1"},"previous_names":["joschi/jadconfig"],"tags_count":19,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Graylog2%2FJadConfig","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Graylog2%2FJadConfig/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Graylog2%2FJadConfig/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Graylog2%2FJadConfig/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Graylog2","download_url":"https://codeload.github.com/Graylog2/JadConfig/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247157281,"owners_count":20893220,"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":["configuration","google-guava","google-guice","guava","guice","java","java-library","joda"],"created_at":"2024-11-12T06:26:51.806Z","updated_at":"2025-04-04T10:05:23.787Z","avatar_url":"https://github.com/Graylog2.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"# JadConfig\n[![Maven Central](https://img.shields.io/maven-central/v/org.graylog/jadconfig.svg)](http://mvnrepository.com/artifact/org.graylog/jadconfig)\n\nJadConfig is a minimalistic annotation-driven configuration parsing framework for Java with minimal dependencies.\n\n\n## Example\n\nHere is a quick example of a Java class used as configuration bean:\n\n    public class ConfigurationBean {\n      @Parameter(\"my.stringList\")\n      public List\u003cString\u003e myList = new ArrayList\u003cString\u003e();\n\n      @Parameter(\"my.integer\")\n      public int myInteger = 1;\n\n      @Parameter(value = \"my.uri\", required = true)\n      public URI myURI;\n    }\n\nand how you initialize it with JadConfig:\n\n    ConfigurationBean bean = new ConfigurationBean();\n    new JadConfig(new PropertiesRepository(\"my.properties\"), bean).process();\n\n    Assert.assertNotNull(bean.myList);\n\n\nYou can also use multiple repositories as source for your configuration (first match wins):\n\n    ConfigurationBean bean = new ConfigurationBean();\n    new JadConfig(\n            Arrays.asList(\n                new EnvironmentRepository(),\n                new PropertiesRepository(\"my.properties\")\n            ),\n            bean)\n        .process();\n\n    Assert.assertNotNull(bean.myList);\n\n### Joda-Time\n\nJadConfig optionally supports [Joda-Time](http://www.joda.org/joda-time/). In order to use it just add the Joda-Time\ndependency to your `pom.xml`:\n\n    \u003cdependency\u003e\n        \u003cgroupId\u003ejoda-time\u003c/groupId\u003e\n        \u003cartifactId\u003ejoda-time\u003c/artifactId\u003e\n        \u003cversion\u003e2.9\u003c/version\u003e\n    \u003c/dependency\u003e\n\n\nAnd register `JodaTimeConverterFactory` with the JadConfig instance:\n\n    JadConfig jadConfig = new JadConfig(repository, configurationBean);\n    jadConfig.addConverterFactory(new JodaTimeConverterFactory());\n    jadConfig.process();\n\n\n### Guava\n\nJadConfig optionally supports some data types from [Google Guava](https://github.com/google/guava/). In order to use\nit just add the Google Guava dependency to your `pom.xml`:\n\n    \u003cdependency\u003e\n        \u003cgroupId\u003ecom.google.guava\u003c/groupId\u003e\n        \u003cartifactId\u003eguava\u003c/artifactId\u003e\n        \u003cversion\u003e18.0\u003c/version\u003e\n    \u003c/dependency\u003e\n\n\nAnd register `GuavaConverterFactory` with the JadConfig instance:\n\n    JadConfig jadConfig = new JadConfig(repository, configurationBean);\n    jadConfig.addConverterFactory(new GuavaConverterFactory());\n    jadConfig.process();\n\n\nCurrently the following data types are being supported:\n\n  * `CacheBuilderSpec`\n  * `HashCode`\n  * `HostAndPort`\n  * `HostSpecifier`\n  * `InternetDomainName`\n  * `MediaType`\n  * `UnsignedInteger`\n  * `UnsignedLong`\n\n\n### Guice\n\nJadConfig optionally supports registering named bindings in [Google Guice](https://github.com/google/guice/). In order\nto use it just add the Google Guice dependency to your `pom.xml`:\n\n    \u003cdependency\u003e\n        \u003cgroupId\u003ecom.google.inject\u003c/groupId\u003e\n        \u003cartifactId\u003eguice\u003c/artifactId\u003e\n        \u003cversion\u003e4.0\u003c/version\u003e\n    \u003c/dependency\u003e\n\n\nAnd register `NamedConfigParametersModule` with the Guice Injector:\n\n    Injector injector = Guice.createInjector(new NamedConfigParametersModule(Collections.singleton(configurationBean)));\n\n\nThe name of the bindings are identical to the `@Parameter` name.\n\nExample:\n\n    public class MyConfigBean {\n        @Parameter(\"my.custom.config\")\n        public String customConfig;\n    }\n\n    // Create injector and register NamedConfigParametersModule.\n    // [...]\n\n    public class MyClass {\n        @Inject\n        public MyClass(@Named(\"my.custom.config\") String customConfig) {\n            // ...\n        }\n    }\n\n    // MyClass will be instantiated with the value of customConfig from the MyConfigBean instance.\n    MyClass myClass = injector.getInstance(MyClass.class);\n\nPlease note that nullable properties which should be injected by Guice have to be annotated with `@Nullable`,\nsee [UseNullable](https://github.com/google/guice/wiki/UseNullable) in the Guice wiki for details.\n\n\n## Maven\n\nTo use JadConfig in your project using Maven add the following lines into the dependencies section of your `pom.xml`:\n\n    \u003cdependency\u003e\n        \u003cgroupId\u003eorg.graylog\u003c/groupId\u003e\n        \u003cartifactId\u003ejadconfig\u003c/artifactId\u003e\n        \u003cversion\u003e0.13.0\u003c/version\u003e\n    \u003c/dependency\u003e\n\n\n## Support\n\nPlease file bug reports and feature requests in [GitHub issues](https://github.com/Graylog2/JadConfig/issues).\n\n\n## License\n\nJadConfig is being released under the Apache License, Version 2.0. You can download the complete license text at\nhttp://www.apache.org/licenses/LICENSE-2.0.html\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgraylog2%2Fjadconfig","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgraylog2%2Fjadconfig","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgraylog2%2Fjadconfig/lists"}