{"id":22870703,"url":"https://github.com/muthuishere/declarativex","last_synced_at":"2026-03-07T20:32:08.625Z","repository":{"id":47779631,"uuid":"394983516","full_name":"muthuishere/declarativex","owner":"muthuishere","description":" Composable approach to exception \u0026 conditions in Java","archived":false,"fork":false,"pushed_at":"2024-09-27T11:39:14.000Z","size":958,"stargazers_count":7,"open_issues_count":1,"forks_count":1,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-07-22T03:52:23.199Z","etag":null,"topics":["declarative-programming","exception-handling","java"],"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/muthuishere.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,"zenodo":null}},"created_at":"2021-08-11T12:37:08.000Z","updated_at":"2024-09-27T11:39:17.000Z","dependencies_parsed_at":"2025-05-05T22:16:07.386Z","dependency_job_id":"c819e71a-6bfa-47da-ace3-9c03ce42858a","html_url":"https://github.com/muthuishere/declarativex","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/muthuishere/declarativex","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/muthuishere%2Fdeclarativex","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/muthuishere%2Fdeclarativex/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/muthuishere%2Fdeclarativex/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/muthuishere%2Fdeclarativex/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/muthuishere","download_url":"https://codeload.github.com/muthuishere/declarativex/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/muthuishere%2Fdeclarativex/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":30063379,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-03-03T18:21:05.932Z","status":"ssl_error","status_checked_at":"2026-03-03T18:20:59.341Z","response_time":61,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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":["declarative-programming","exception-handling","java"],"created_at":"2024-12-13T13:15:48.624Z","updated_at":"2026-03-07T20:32:08.584Z","avatar_url":"https://github.com/muthuishere.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"### DeclarativeX\n######  A Composable approach to exception \u0026 conditions in Java\n\n![Coverage](.github/badges/jacoco.svg)\n![Branches](.github/badges/branches.svg)\n\n\n\n![Composing Exceptions with DeclarativeX](https://github.com/muthuishere/declarativex-example/blob/main/assets/withthis1.png?raw=true)\n\n----\n\n\n![Composing Exceptions with DeclarativeX for same parameters](https://github.com/muthuishere/declarativex-example/blob/main/assets/withthis2.png?raw=true)\n\n----\n\n![On Error](https://github.com/muthuishere/declarativex-example/blob/main/assets/onerror3.png?raw=true)\n\n\nMaven\n\n```\n        \u003cdependency\u003e\n            \u003cgroupId\u003eio.github.muthuishere\u003c/groupId\u003e\n            \u003cartifactId\u003edeclarativex\u003c/artifactId\u003e            \n        \u003c/dependency\u003e\n```\n    \nGradle\n```\nimplementation \"io.github.muthuishere:declarativex\"\n```\n\nUsage\n```\nimport declarativex.Try;\nimport declarativex.Filter;\n\n\n\n```\n\n\n## Try\n\u003cb\u003eInstead of Writing This\u003c/b\u003e \n\n```\nList\u003cString\u003e results = null;\n\n        try {\n            results =newsService.downloadFromNyTimes(topic);\n        }catch (Exception e){\n\n            try {\n\n                results =newsService.downloadFromHerald(topic);\n            }catch (Exception e1){\n                try {\n                    results =newsService.downloadFromSun(topic);\n                }catch (Exception e2){\n\n\n                }\n            }\n        }\n\n```\n \n\u003cb\u003eWrite This\u003c/b\u003e\n \n ```\nimport declarativex.Try;\n\n        results= Try.from(()-\u003enewsService.downloadFromNyTimes(topic))\n                        .or(()-\u003enewsService.downloadFromHerald(topic))\n                        .or(()-\u003enewsService.downloadFromSun(topic))\n                        .get();\n\n```\n\n\u003cb\u003eOr Even Better way\u003c/b\u003e\n```\nresults= Try.any(newsService::downloadFromNyTimes,\n                         newsService::downloadFromHerald,\n                         newsService::downloadFromSun)\n                        .with(topic)\n                        .orElseGet(Arrays.asList(\"Some default\"));\n\n```\n\nThere are Additional Logging , Peek ,PeekError ,default value can convert to Optional as well\n\nAlso there is a lazy version of the same\n\n```\nresults = Try.lazy.from(this::downloadCacheData)\n                .get();\n\n//Evaluation happens only after get is Invoked\n\n``` \n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmuthuishere%2Fdeclarativex","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmuthuishere%2Fdeclarativex","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmuthuishere%2Fdeclarativex/lists"}