{"id":18348408,"url":"https://github.com/johnlcox/motif","last_synced_at":"2026-03-05T02:03:08.766Z","repository":{"id":32408595,"uuid":"35985413","full_name":"johnlcox/motif","owner":"johnlcox","description":"Scala-like pattern matching for Java 8","archived":false,"fork":false,"pushed_at":"2018-02-07T01:57:06.000Z","size":600,"stargazers_count":150,"open_issues_count":4,"forks_count":4,"subscribers_count":13,"default_branch":"master","last_synced_at":"2025-08-20T01:22:35.819Z","etag":null,"topics":["lambda","pattern-matching","scala"],"latest_commit_sha":null,"homepage":"http://john.leacox.com/motif","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/johnlcox.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":"2015-05-21T02:09:07.000Z","updated_at":"2025-08-13T11:13:28.000Z","dependencies_parsed_at":"2022-08-23T03:20:24.030Z","dependency_job_id":null,"html_url":"https://github.com/johnlcox/motif","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/johnlcox/motif","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/johnlcox%2Fmotif","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/johnlcox%2Fmotif/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/johnlcox%2Fmotif/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/johnlcox%2Fmotif/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/johnlcox","download_url":"https://codeload.github.com/johnlcox/motif/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/johnlcox%2Fmotif/sbom","scorecard":{"id":528636,"data":{"date":"2025-08-11","repo":{"name":"github.com/johnlcox/motif","commit":"33a72d79fcbac16c89f8c4b0567856f2442f59be"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":3,"checks":[{"name":"Code-Review","score":0,"reason":"Found 0/30 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":"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":"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":"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":"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":"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":"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":"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":"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":"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":"License","score":10,"reason":"license file detected","details":["Info: project has a license file: LICENSE:0","Info: FSF or OSI recognized license: Apache License 2.0: 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":"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":"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"}},{"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"}}]},"last_synced_at":"2025-08-20T05:07:19.787Z","repository_id":32408595,"created_at":"2025-08-20T05:07:19.787Z","updated_at":"2025-08-20T05:07:19.787Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":30106153,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-03-05T01:39:18.192Z","status":"online","status_checked_at":"2026-03-05T02:00:06.710Z","response_time":93,"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":["lambda","pattern-matching","scala"],"created_at":"2024-11-05T21:17:52.464Z","updated_at":"2026-03-05T02:03:08.740Z","avatar_url":"https://github.com/johnlcox.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"Motif\n=====\n\nA pattern matching library for Java 8. Motif provides scala-like pattern matching in Java 8.\n\n## Examples\n\n### FizzBuzz\n\n```java\nIntStream.range(0, 101).forEach(\n    n -\u003e System.out.println(\n        match(Tuple2.of(n % 3, n % 5))\n            .when(tuple2(eq(0), eq(0))).get(() -\u003e \"FizzBuzz\")\n            .when(tuple2(eq(0), any())).get(y -\u003e \"Fizz\")\n            .when(tuple2(any(), eq(0))).get(x -\u003e \"Buzz\")\n            .orElse(String.valueOf(n))\n            .getMatch()\n    )\n);\n```\n\n### Optional\n\n```java\nOptional\u003cPerson\u003e personOpt = getPerson();\nmatch(personOpt)\n    .when(some(any())).then(person -\u003e doStuff(person))\n    .when(none()).then(() -\u003e System.out.println(\"Person not found\"))\n    .doMatch();\n```\n\n### Factorial\n\n```java\npublic long factorial(long i) {\n  return match(i)\n      .when(eq(0)).get(() -\u003e 1l)\n      .when(any()).get(x -\u003e x * factorial(x - 1))\n      .getMatch();\n}\n```\n\n### Nested Matching\n\n```java\nOptional\u003cTuple2\u003cString, String\u003e\u003e opt = Optional.of(Tuple2.of(\"first\", \"second\"));\nmatch(opt)\n    .when(some(tuple2(eq(\"third\"), any()))).then(b -\u003e doStuff(b))\n    .when(some(tuple2(any(), eq(\"second\")))).then(a -\u003e doStuff(a))\n    .when(none()).then(() -\u003e System.out.println(\"Tuple not found\"))\n    .doMatch();\n```\n\n### List Cons Matching\n\n```java\nList\u003cString\u003e list = Arrays.asList(\"a\", \"b\", \"c\", \"d\");\nmatch(list)\n    .when(nil()).then(() -\u003e System.out.println(\"Empty List\"))\n    .when(headNil(eq(\"b\"))).then(() -\u003e System.out.println(\"Singleton List of 'b'\"))\n    .when(headNil(any())).then(head -\u003e System.out.println(\"Singleton List of \" + head))\n    .when(headTail(any(), any())).then(\n        (head, tail) -\u003e System.out.println(\"head: \" + head + \" Remaining: \" + tail))\n    .doMatch();\n```\n\n## Download\n\nDownload the latest JAR via Maven:\n\n```xml\n\u003cdependency\u003e\n  \u003cgroupId\u003ecom.leacox.motif\u003c/groupId\u003e\n  \u003cartifactId\u003emotif\u003c/artifactId\u003e\n  \u003cversion\u003e0.1\u003c/version\u003e\n\u003c/dependency\u003e\n```\n\n## License\n\n    Copyright 2015 John Leacox\n\n    Licensed under the Apache License, Version 2.0 (the \"License\");\n    you may not use this file except in compliance with the License.\n    You may obtain a copy of the License at\n\n        http://www.apache.org/licenses/LICENSE-2.0\n\n    Unless required by applicable law or agreed to in writing, software\n    distributed under the License is distributed on an \"AS IS\" BASIS,\n    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n    See the License for the specific language governing permissions and\n    limitations under the License.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjohnlcox%2Fmotif","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjohnlcox%2Fmotif","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjohnlcox%2Fmotif/lists"}