{"id":37019900,"url":"https://github.com/chinhung/pointwave","last_synced_at":"2026-01-14T02:13:50.400Z","repository":{"id":57732766,"uuid":"379276924","full_name":"chinhung/pointwave","owner":"chinhung","description":"Helps you to improve the readability of your code when you are using the Decorator pattern. Makes your code much more readable!","archived":false,"fork":false,"pushed_at":"2021-10-14T15:12:34.000Z","size":39,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2023-07-04T01:05:57.049Z","etag":null,"topics":["decorator-pattern","java8","readability"],"latest_commit_sha":null,"homepage":"","language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/chinhung.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":"2021-06-22T13:19:54.000Z","updated_at":"2021-10-14T15:12:37.000Z","dependencies_parsed_at":"2022-09-26T22:11:09.384Z","dependency_job_id":null,"html_url":"https://github.com/chinhung/pointwave","commit_stats":null,"previous_names":[],"tags_count":0,"template":null,"template_full_name":null,"purl":"pkg:github/chinhung/pointwave","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chinhung%2Fpointwave","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chinhung%2Fpointwave/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chinhung%2Fpointwave/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chinhung%2Fpointwave/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/chinhung","download_url":"https://codeload.github.com/chinhung/pointwave/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chinhung%2Fpointwave/sbom","scorecard":{"id":277974,"data":{"date":"2025-08-11","repo":{"name":"github.com/chinhung/pointwave","commit":"5a6537d9462c37b34a65e01392cd5047dccfa02a"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":3,"checks":[{"name":"Packaging","score":-1,"reason":"packaging workflow not detected","details":["Warn: no GitHub/GitLab publishing workflow detected."],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#packaging"}},{"name":"Code-Review","score":0,"reason":"Found 0/29 approved changesets -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#code-review"}},{"name":"Maintained","score":0,"reason":"0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"name":"SAST","score":0,"reason":"no SAST tool detected","details":["Warn: no pull requests merged into dev branch"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}},{"name":"Pinned-Dependencies","score":-1,"reason":"no dependencies found","details":null,"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#pinned-dependencies"}},{"name":"Dangerous-Workflow","score":-1,"reason":"no workflows found","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#dangerous-workflow"}},{"name":"Binary-Artifacts","score":10,"reason":"no binaries found in the repo","details":null,"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#binary-artifacts"}},{"name":"Token-Permissions","score":-1,"reason":"No tokens found","details":null,"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#token-permissions"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#cii-best-practices"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#fuzzing"}},{"name":"Vulnerabilities","score":10,"reason":"0 existing vulnerabilities detected","details":null,"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}},{"name":"Signed-Releases","score":-1,"reason":"no releases found","details":null,"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#signed-releases"}},{"name":"Security-Policy","score":0,"reason":"security policy file not detected","details":["Warn: no security policy file detected","Warn: no security file to analyze","Warn: no security file to analyze","Warn: no security file to analyze"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#security-policy"}},{"name":"License","score":10,"reason":"license file detected","details":["Info: project has a license file: LICENSE:0","Info: FSF or OSI recognized license: MIT License: LICENSE:0"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"name":"Branch-Protection","score":0,"reason":"branch protection not enabled on development/release branches","details":["Warn: branch protection not enabled for branch 'master'"],"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#branch-protection"}}]},"last_synced_at":"2025-08-17T14:59:33.268Z","repository_id":57732766,"created_at":"2025-08-17T14:59:33.269Z","updated_at":"2025-08-17T14:59:33.269Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28408711,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-14T01:52:23.358Z","status":"online","status_checked_at":"2026-01-14T02:00:06.678Z","response_time":107,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"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":["decorator-pattern","java8","readability"],"created_at":"2026-01-14T02:13:49.773Z","updated_at":"2026-01-14T02:13:50.386Z","avatar_url":"https://github.com/chinhung.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"# PointWave \u003cimg src=\"https://i.imgur.com/cdTBqH8.jpg\" width=\"60\" height=\"60\"\u003e\n[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://github.com/chinhung/pointwave/blob/master/LICENSE)\n![Coverage](https://img.shields.io/badge/coverage-100%25-brightgreen)\n![Maven Central](https://img.shields.io/maven-central/v/io.github.chinhung/pointwave)\n\nHelps you to improve the readability of your code when you are using the Decorator pattern.\n\nMakes your code much more readable!\n\n## Getting Started\nFor Gradle, add the following dependency in `build.gradle`：\n```groovy\ndependencies {\n    implementation 'io.github.chinhung:pointwave:1.0.0'\n}\n```\n\nFor Maven, add the following dependency in `pom.xml`：\n```xml\n\u003cdependency\u003e\n    \u003cgroupId\u003eio.github.chinhung\u003c/groupId\u003e\n    \u003cartifactId\u003epointwave\u003c/artifactId\u003e\n    \u003cversion\u003e1.0.0\u003c/version\u003e\n\u003c/dependency\u003e\n```\n\nIf you use other build tool, please visit [Maven Central](https://mvnrepository.com/artifact/io.github.chinhung/pointwave).\n\n## Tutorial\nFirst, call the static method `PointWave.decoratee` to initialize the decoratee. And then, call the method `decorated` with the decorator function as the argument in lambda expression, one by one. The last step is to call `complete` method, which returns the decorated object:\n```java\nObject decorated = PointWave.decoratee(decoratee)\n    .decorated(decoratee -\u003e decorator1Factory.create(decoratee, param1))\n    .decorated(decoratee -\u003e Decorator2.createInstance(decoratee, param2))\n    .decorated(decoratee -\u003e new Decorator3(decoratee, param3))\n    .complete();\n```\n- the decorator function is a function which receives the decoratee and returns the decorated object\n- the decorator functions will be applied following the \"First In, First Out\" rule (in this example, the inner layer of the decorated object is `decoratee`, the second layer is `Decorator1`, the third layer is `Decorator2` and the outer layer is `Decorator3`)\n- provides generic support\n\n## Example\n```java\npublic class HelloWorld {\n\n    @Override\n    public String toString() {\n        return \"Hello World!\";\n    }\n}\n```\n\n```java\npublic class NameDecorator extends HelloWorld {\n    \n    private final HelloWorld decoratee;\n    private final String name;\n    \n    public NameDecorator(final HelloWorld decoratee, final String name) {\n        this.decoratee = decoratee;\n        this.name = name;\n    }\n\n    @Override\n    public String toString() {\n        return decoratee.toString() + \" \" + name + \"!\";\n    }\n}\n```\n\n```java\npublic class TodayDecorator extends HelloWorld {\n    \n    private final HelloWorld decoratee;\n    private final String today;\n    \n    public TodayDecorator(final HelloWorld decoratee, final String today) {\n        this.decoratee = decoratee;\n        this.today = today;\n    }\n\n    @Override\n    public String toString() {\n        return decoratee.toString() + \" Today is \" + today + \"!\";\n    }\n}\n```\n\n```java\nHelloWorld decorated = PointWave.decoratee(new HelloWorld())\n    .decorated(decoratee -\u003e new NameDecorator(decoratee, \"John Doe\"))\n    .decorated(decoratee -\u003e new TodayDecorator(decoratee, \"Friday\"))\n    .complete();\n\nassertEquals(\"Hello World! John Doe! Today is Friday!\", decorated.toString());\n```\n\n\n## Why PointWave\n\n### Without PointWave\n\nThe code is not readable if you decorate the object manually in the following coding style:\n1. a single line code\n```java\nObject decorated = new Decorator3(Decorator2.createInstance(decorator1Factory.create(decoratee, param1), param2), param3);\n```\n\n2. deeply nested code\n```java\nObject decorated = new Decorator3(\n    Decorator2.createInstance(\n        decorator1Factory.create(\n            decoratee, \n            param1\n        ), \n        param2\n    ), \n    param3\n);\n```\n\nWe could improve the readability of the code by using a temporary local variable:\n\n```java\nObject decorated = decoratee;\ndecorated = decorator1Factory.create(decorated, param1);\ndecorated = Decorator2.createInstance(decorated, param2);\ndecorated = new Decorator3(decorated, param3);\n```\n\nHowever, the code style is imperative.\n\n### With PointWave\n\nThe code style is continuous and similar to the builder pattern, which is more meaningful. Also, an appropriately designed api brings more intention of the code to the reader:\n```java\nObject decorated = PointWave.decoratee(decoratee)\n    .decorated(decoratee -\u003e decorator1Factory.create(decoratee, param1))\n    .decorated(decoratee -\u003e Decorator2.createInstance(decoratee, param2))\n    .decorated(decoratee -\u003e new Decorator3(decoratee, param3))\n    .complete();\n```\n\nEven more, the intention would be more clear if the decorator functions were named appropriately:\n```java\nFunction withDecorator1 = decoratee -\u003e decorator1Factory.create(decoratee, param1);\nFunction withDecorator2 = decoratee -\u003e Decorator2.createInstance(decorated, param2);\nFunction withDecorator3 = decoratee -\u003e new Decorator3(decorated, param3);\n\nObject decorated = PointWave.decoratee(decoratee)\n    .decorated(withDecorator1)\n    .decorated(withDecorator2)\n    .decorated(withDecorator3)\n    .complete();\n```\n\n## Todo\n\n- abstract `Decoratee` as interface\n- refactor the code to functional style\n- use `Github Actions` to build and test the code\n- write`Javadoc`\n  \n## Note\n- use `Git Flow` in this project\n- incremental delivery","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fchinhung%2Fpointwave","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fchinhung%2Fpointwave","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fchinhung%2Fpointwave/lists"}