{"id":24441886,"url":"https://github.com/abnamrocoesd/toggleproc","last_synced_at":"2025-04-12T20:43:36.414Z","repository":{"id":57716447,"uuid":"112761951","full_name":"abnamrocoesd/ToggleProc","owner":"abnamrocoesd","description":"Make your toggles manageable with this library.","archived":false,"fork":false,"pushed_at":"2018-11-15T11:56:53.000Z","size":167,"stargazers_count":4,"open_issues_count":1,"forks_count":2,"subscribers_count":5,"default_branch":"develop","last_synced_at":"2025-03-26T14:56:03.934Z","etag":null,"topics":["android","annotations","based","development","java","library","tbdev","toggles","trunk"],"latest_commit_sha":null,"homepage":"","language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/abnamrocoesd.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-12-01T16:30:37.000Z","updated_at":"2021-01-15T19:28:59.000Z","dependencies_parsed_at":"2022-09-26T16:40:28.086Z","dependency_job_id":null,"html_url":"https://github.com/abnamrocoesd/ToggleProc","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/abnamrocoesd%2FToggleProc","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/abnamrocoesd%2FToggleProc/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/abnamrocoesd%2FToggleProc/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/abnamrocoesd%2FToggleProc/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/abnamrocoesd","download_url":"https://codeload.github.com/abnamrocoesd/ToggleProc/tar.gz/refs/heads/develop","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248631676,"owners_count":21136555,"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":["android","annotations","based","development","java","library","tbdev","toggles","trunk"],"created_at":"2025-01-20T21:42:35.058Z","updated_at":"2025-04-12T20:43:36.377Z","avatar_url":"https://github.com/abnamrocoesd.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"\n# ToggleProc\nMake your toggles manageable with this library.\n\nFeatures:\n* Build-time information about the toggles such as:\n  * toggle expiration\n  * exceeding number of toggles\n  * Too futuristic toggles\n* Configure whether the build breaks or gives warning when the above conditions are not met\n* Use annotation to define the toggles\n* TODO: use this library for A/B testing\n\n# Getting started\nAdd the dependency\n```\nrepositories {\n     mavenCentral()\n}\n\ndependencies {\n  //...\n  compile('com.abnamro:toggleproc:1.1')\n  annotationProcessor('com.abnamro:toggleproc:1.1')\n  //...\n}\n```\n\n# Configuration class\n\nThe configuration file is annotated with `@FeatureToggleConfiguration`, which expects 2 parameters:\n- strictnessPolicy {COOL, MODERATE, HARSH}\n  - COOL: no build error, only warnings\n  - MODERATE: build error when the toggle is expired, in other cases build warning\n  - HARSH: build error when toggle is expired, the number of toggles exceed the maxNumberOfToggles and when the toggles are too futuristic (a period of 8 weeks)\n - maxNumberOfToggles: max number of toggles allowed in this configuration file. \n```\n@FeatureToggleConfiguration(strictnessPolicy = FeatureToggleConfiguration.StrictnessPolicy.COOL, maxNumberOfToggles = 6)\npublic class Config{\n}\n```\nDefine the toggles in the configuration file, the toggles are fields of type boolean with accessibility modifier default (if the manager class and configuration class are in the samen package) or public. Toggles are annotated by `@FeatureToggleBind(expirationDate = \"yyyy-MM-dd\", toggleName = \"name\")`, which has two parameters\n- expirationDate: yyyy-MM-dd, e.g. 2017-12-30\n- name: a name\n\n```\n@FeatureToggleConfiguration(strictnessPolicy = FeatureToggleConfiguration.StrictnessPolicy.COOL, maxNumberOfToggles = 3)\npublic class Config {\n    @FeatureToggleBind(expirationDate = \"2018-01-01\", toggleName = \"test1\")\n    boolean test1;\n    @FeatureToggleBind(expirationDate = \"2018-01-01\", toggleName = \"test2\")\n    boolean test2;\n    @FeatureToggleBind(expirationDate = \"2018-01-01\", toggleName = \"test3\")\n    boolean test3;\n    @FeatureToggleBind(expirationDate = \"2017-01-01\", toggleName = \"test4\")\n    boolean test4;\n    \n    public boolean isTest1() {\n        return test1;\n    }\n    public boolean isTest2() {\n        return test2;\n    }\n    public boolean isTest3() {\n        return test3;\n    }\n    public boolean isTest4() {\n        return test4;\n    }\n}\n```\n\n# Manager class\n\nThe manager class is responsible for the implementation of the toggle. It implements the FeatureToggler interface:\n```\npublic interface FeatureToggler {\n    boolean isEnabled(String toggleName);\n}\n```\nThe method isEnabled accepts toggleName as parameter and returns true if the toggle is enabled. For example if you use Firebase Remote Config the its implementation will be something like\n```\npublic class FeatureToggleManager implements FeatureToggler {\n    private final FeatureToggleConfig config;\n\n\n    protected FeatureToggleManager(Config config) {\n        this.config = config;\n        FeatureToggleBinder.bind(this, config);\n    }\n\n    public Config getToggles() {\n        return config;\n    }\n\n    @override\n    public boolean isEnabled(final String name){\n        return mFirebaseRemoteConfig.getBoolean(name);\n    }\n}\n```\n\nThe manager uses the generated `FeatureToggleBinder.bind(this, config)` to bind the values.\n\n# Usage\n\nTo use, just simply create a new instance of Manager (or use singleton) and use the `getToggles()`.\n```\nFeatureToggleManager manager = new FeatureToggleManager(new Config);\nboolean isTest1Enabled = manager.getToggles().isTest1();\n...\n```\nDemo: https://github.com/BakhtarSobat/aac/tree/toggleProcDemo\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fabnamrocoesd%2Ftoggleproc","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fabnamrocoesd%2Ftoggleproc","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fabnamrocoesd%2Ftoggleproc/lists"}