{"id":15068819,"url":"https://github.com/romanqed/jconv","last_synced_at":"2026-01-20T00:04:07.766Z","repository":{"id":218225235,"uuid":"744237334","full_name":"RomanQed/jconv","owner":"RomanQed","description":"Flexible and lightweight pipeline implementation for java 11+ in style ASP.NET middleware.","archived":false,"fork":false,"pushed_at":"2024-10-05T21:24:43.000Z","size":31,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2024-11-22T07:06:06.989Z","etag":null,"topics":["action","conveyer","conveyor","java","java-11","java-17","java11","java17","lightweight","middleware","pipeline","task"],"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/RomanQed.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":"2024-01-16T22:15:02.000Z","updated_at":"2024-10-05T21:24:47.000Z","dependencies_parsed_at":"2024-01-31T21:34:26.523Z","dependency_job_id":"dc87a442-f14c-4f7f-b1b1-d67add5cfbd3","html_url":"https://github.com/RomanQed/jconv","commit_stats":null,"previous_names":["romanqed/jconv"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RomanQed%2Fjconv","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RomanQed%2Fjconv/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RomanQed%2Fjconv/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RomanQed%2Fjconv/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/RomanQed","download_url":"https://codeload.github.com/RomanQed/jconv/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":225855966,"owners_count":17534966,"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":["action","conveyer","conveyor","java","java-11","java-17","java11","java17","lightweight","middleware","pipeline","task"],"created_at":"2024-09-25T01:39:23.907Z","updated_at":"2026-01-20T00:04:07.754Z","avatar_url":"https://github.com/RomanQed.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"# jconv [![jconv](https://img.shields.io/maven-central/v/com.github.romanqed/jconv?strategy=releaseProperty\u0026style=for-the-badge\u0026label=jconv\u0026color=blue)](https://repo1.maven.org/maven2/com/github/romanqed/jconv)\n\nFlexible and lightweight pipeline implementation for Java 11+, inspired by ASP.NET middleware design.\n\n## Features\n\n- Fluent API to build conditional and nested middleware pipelines\n- Supports synchronous, asynchronous, and unified task consumers\n- Zero-overhead design suitable for high-performance scenarios\n- Clear separation between middleware (TaskConsumer) and terminal tasks (Task)\n- Conditional branching with `addWhen` (like ASP.NET UseWhen) and `mapWhen` (like ASP.NET MapWhen)\n- Easy integration with Java CompletableFuture for async execution\n\n## Getting Started\n\n### Requirements\n\n- Java 11 or higher\n- Maven or Gradle build system\n\n## Installation\n\n### Gradle\n\n```groovy\ndependencies {\n    implementation group: 'com.github.romanqed', name: 'jconv', version: '2.0.0'\n}\n```\n\n### Maven\n\n```xml\n\u003cdependency\u003e\n    \u003cgroupId\u003ecom.github.romanqed\u003c/groupId\u003e\n    \u003cartifactId\u003ejconv\u003c/artifactId\u003e\n    \u003cversion\u003e2.0.0\u003c/version\u003e\n\u003c/dependency\u003e\n```\n\n## Usage Examples\n\n### Basic Middleware Pipeline\n\n```java\nimport com.github.romanqed.jconv.TaskBuilders;\n\npublic class Main {\n    public static void main(String[] args) throws Throwable {\n        var builder = TaskBuilders.\u003cInteger\u003elinked();\n        var pipeline = builder\n                .add((c, next) -\u003e {\n                    System.out.println(\"{ - 1\");\n                    next.run(c);\n                    System.out.println(\"} - 4\");\n                })\n                .add((c, next) -\u003e {\n                    System.out.println(c + \" - 2\");\n                    next.run(c - 1);\n                })\n                .add((c, next) -\u003e {\n                    System.out.println(c + \" - 3\");\n                })\n                .build();\n\n        pipeline.run(10);\n    }\n}\n```\n\nOutput:\n\n```\n{ - 1\n10 - 2\n9 - 3\n} - 4\n```\n\n### Exception Handling in Pipeline\n\n```Java\nimport com.github.romanqed.jconv.TaskBuilders;\nimport java.io.IOException;\n\npublic class Main {\n    public static void main(String[] args) throws Throwable {\n        var builder = TaskBuilders.\u003cObject\u003elinked();\n        var pipeline = builder\n                .add((ctx, next) -\u003e {\n                    try {\n                        next.run(ctx);\n                    } catch (IOException e) {\n                        System.out.println(\"Caught IOException:\");\n                        e.printStackTrace();\n                    }\n                })\n                .add((ctx, next) -\u003e {\n                    throw new IOException(\"Simulated I/O error\");\n                })\n                .build();\n\n        pipeline.run(null);\n    }\n}\n```\n\nOutput:\n\n```\nCaught IOException:\njava.io.IOException: Simulated I/O error\n    at Main.lambda$main$1(Main.java:...)\n    ...\n```\n\n### Short-Circuiting Execution\n\n```Java\nimport com.github.romanqed.jconv.TaskBuilders;\n\npublic class Main {\n    public static void main(String[] args) throws Throwable {\n        var builder = TaskBuilders.\u003cInteger\u003elinked();\n        var pipeline = builder\n                .add((c, next) -\u003e {\n                    if (c \u003e 0) {\n                        next.run(c);\n                    } // else short-circuit: do nothing, next tasks won't run\n                })\n                .add((c, next) -\u003e {\n                    System.out.println(\"Processed: \" + c);\n                })\n                .build();\n\n        pipeline.run(5);  // Prints \"Processed: 5\"\n        pipeline.run(0);  // Prints nothing\n    }\n}\n```\n\n### Conditional Branching with addWhen (like UseWhen)\n\n```java\nvar pipeline = TaskBuilders.\u003cString\u003elinked()\n    .addWhen(s -\u003e s.startsWith(\"admin\"), b -\u003e {\n        b.add((s, next) -\u003e {\n            System.out.println(\"Admin branch: \" + s);\n            next.run(s);\n        });\n    })\n    .add((s, next) -\u003e {\n        System.out.println(\"Common branch: \" + s);\n    })\n    .build();\n\npipeline.run(\"adminUser\");  // Prints both Admin branch and Common branch messages\npipeline.run(\"guestUser\");  // Prints only Common branch message\n```\n\n### Conditional Branching with mapWhen (like MapWhen)\n\n```java\nvar pipeline = TaskBuilders.\u003cString\u003elinked()\n    .mapWhen(s -\u003e s.startsWith(\"admin\"), (s) -\u003e {\n        System.out.println(\"Admin mapped branch: \" + s);\n    })\n    .add((s, next) -\u003e {\n        System.out.println(\"Common branch: \" + s);\n    })\n    .build();\n\npipeline.run(\"adminUser\");  // Prints only Admin mapped branch message\npipeline.run(\"guestUser\");  // Prints only Common branch message\n```\n\nNote: `mapWhen` replaces the pipeline if condition is true, short-circuiting subsequent middleware.\n\n## API Overview\n\n- **Task\u003cT\u003e** — terminal unit of work (sync, async or unified)\n- **TaskConsumer\u003cT\u003e** — middleware consumer that can delegate downstream\n- **TaskConfigurer\u003cT\u003e** — fluent interface for building pipeline steps\n- **TaskBuilder\u003cT\u003e** — interface to assemble and build pipelines\n- **TaskBuilders** — factory for creating pipeline builders (e.g., linked)\n\n## Built With\n\n* [Gradle](https://gradle.org) - Dependency management\n* [jfunc](https://github.com/RomanQed/jfunc) - Functional interfaces and utilities\n* [jsync](https://github.com/RomanQed/jfunc) - Async functional interfaces and helpers\n* [juni](https://github.com/RomanQed/jfunc) - Unified sync/async interfaces\n\n## Authors\n\n* **[RomanQed](https://github.com/RomanQed)** - Main author\n\nSee also the list of [contributors](https://github.com/RomanQed/jconv/contributors)\nwho participated in this project.\n\n## License\n\nThis project is licensed under the Apache License 2.0 — see the [LICENSE](LICENSE) file for details\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fromanqed%2Fjconv","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fromanqed%2Fjconv","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fromanqed%2Fjconv/lists"}