{"id":37021417,"url":"https://github.com/codegeny/codegeny-beans","last_synced_at":"2026-01-14T02:31:34.836Z","repository":{"id":57739141,"uuid":"99584491","full_name":"codegeny/codegeny-beans","owner":"codegeny","description":"Library which provides meta-model, diffs, paths... for java beans","archived":false,"fork":false,"pushed_at":"2021-01-05T09:32:22.000Z","size":273,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"master","last_synced_at":"2025-08-01T15:10:52.714Z","etag":null,"topics":["beans","diff","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/codegeny.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-08-07T14:05:27.000Z","updated_at":"2024-09-16T12:58:03.000Z","dependencies_parsed_at":"2022-08-24T17:40:20.538Z","dependency_job_id":null,"html_url":"https://github.com/codegeny/codegeny-beans","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/codegeny/codegeny-beans","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/codegeny%2Fcodegeny-beans","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/codegeny%2Fcodegeny-beans/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/codegeny%2Fcodegeny-beans/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/codegeny%2Fcodegeny-beans/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/codegeny","download_url":"https://codeload.github.com/codegeny/codegeny-beans/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/codegeny%2Fcodegeny-beans/sbom","scorecard":{"id":296443,"data":{"date":"2025-08-11","repo":{"name":"github.com/codegeny/codegeny-beans","commit":"62cab5e9675279f67f94596cdf612eb43923f35d"},"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":"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":"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":"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":"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":"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":"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":"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":"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.txt:0","Info: FSF or OSI recognized license: Apache License 2.0: LICENSE.txt: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-17T19:37:28.492Z","repository_id":57739141,"created_at":"2025-08-17T19:37:28.492Z","updated_at":"2025-08-17T19:37:28.492Z"},"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":["beans","diff","java"],"created_at":"2026-01-14T02:31:34.347Z","updated_at":"2026-01-14T02:31:34.823Z","avatar_url":"https://github.com/codegeny.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"![Status experimental](https://img.shields.io/badge/status-experimental-red.svg)\r\n[![Build Status](https://img.shields.io/travis/codegeny/codegeny-beans.svg)](https://travis-ci.org/codegeny/codegeny-beans)\r\n[![Maven Central](https://img.shields.io/maven-central/v/org.codegeny/codegeny-beans.svg)](https://mvnrepository.com/artifact/org.codegeny/codegeny-beans)\r\n[![Code Coverage](https://img.shields.io/codecov/c/github/codegeny/codegeny-beans.svg)](https://codecov.io/gh/codegeny/codegeny-beans)\r\n[![Code Analysis](https://img.shields.io/codacy/grade/2a447b2e20e34b628cef941f7619e184.svg)](https://www.codacy.com/app/codegeny/codegeny-beans)\r\n\r\n# codegeny-beans\r\n\r\nExpress your bean structure in a reflection-free, dependency-free and type-safe model; get generic diff/comparison/toString/toJson...\r\n\r\nThis project makes heavy (maybe too much) use of the visitor pattern to avoid casting where possible.\r\n\r\n## The Model interface\r\n\r\nA `Model` is used to express the hierarchical structure of an object in a type-safe and reflection-free way.\r\n\r\nIn turn, once you have your model defined, you can use it to generate a toString for your object, compare objects, diff objects, hash objects... \r\n\r\nThe `Model\u003cT\u003e` interface represents a node in the hierarchical structure for an object of type `T` and can be of one of the following concrete classes:\r\n\r\n- `ValueModel\u003cT\u003e` which represents an atomic value of type `T`. Atomic values must be comparable or a comparator must be given to the `ValueModel`.\r\n- `ListModel\u003cL, E\u003e` represents a list-like value (of type `L`) of other models (of type `E`). Note that `L` is not required to be of type `List\u003cE\u003e` but then a transformation function (`Function\u003cL, List\u003cE\u003e\u003e`) must be given to the `ListModel`.\r\n- `SetModel\u003cS, E\u003e` represents a set-like value (of type `S`) of other models (of type `E`). Note that `S` is not required to be of type `Set\u003cE\u003e` but then a transformation function (`Function\u003cS, Set\u003cE\u003e\u003e`) must be given to the `SetModel`.\r\n- `MapModel\u003cM, K, V\u003e` represents a map-like value (of type `M`) of keys (`K`) and values (`V`). As with lists and sets, `M` is not required to be of type `Map\u003cK, V\u003e` but a `Function\u003cM, Map\u003cK, V\u003e\u003e` must be given to the `MapModel`.\r\n- `BeanModel\u003cB\u003e` represents a bean of type `B`. A `BeanModel` contains a map of properties (`Map\u003cString, Property\u003cB, ?\u003e\u003e`).\r\n\r\nThe `Model\u003cT\u003e` interface accepts `DiffVisitor\u003cT, R\u003e`s (`R` being the result type).\r\n\r\n### Example\r\n\r\nLets define the following classes:\r\n\r\n```java\r\npublic class Person {\r\n\r\n\tprivate String firstName;\r\n\tprivate String lastName;\r\n\tprivate LocalDate birthDate;\r\n\tprivate Address mainAddress;\r\n\tprivate Set\u003cAddress\u003e formerAddresses;\r\n\t\r\n\t// getters and setters\r\n}\r\n\r\npublic class Address {\r\n\r\n\tprivate String street;\r\n\tprivate String houseNumber;\r\n\tprivate String zipCode;\r\n\tprivate String city;\r\n\tprivate Country country;\r\n\r\n\t// getters and setters\r\n}\r\n\r\npublic enum Country {\r\n\r\n\tUSA, FRANCE, GERMANY, ITALY, SPAIN, JAPAN...\r\n}\r\n```\r\n\r\nThe structure of the class Person can be defined as follows:\r\n\r\n```java\r\nModel\u003cAddress\u003e addressModel = Model.bean(Address.class,\r\n\tModel.property(\"street\", Address::getStreet, Model.STRING),\r\n\tModel.property(\"houseNumber\", Address::getHouseNumber, Model.STRING),\r\n\tModel.property(\"city\", Address::getZipCode, Model.STRING),\r\n\tModel.property(\"country\", Address::getCity, Model.STRING),\r\n\tModel.property(\"street\", Address::getCountry, Model.value(Country.class))\r\n);\r\n\r\nModel\u003cPerson\u003e personModel = Model.bean(Person.class,\r\n\tModel.property(\"firstName\", Person::getFirstName, Model.STRING),\r\n\tModel.property(\"lastName\", Person::getLastName, Model.STRING),\r\n\tModel.property(\"birthDate\", Person::getBirthDate, Model.value(LocalDate.class)),\r\n\tModel.property(\"mainAddress\", Person::getMainAddress, addressModel),\r\n\tModel.property(\"formerAddresses\", Person::getFormerAddresses, Model.set(addressModel))\r\n);\r\n```\r\n\r\nNote that instead of using getters method references (`Person::getFirstName`), a lambda could also be used (`(Person p) -\u003e p.getFirstName().toUpperCase()`).\r\nThis allows to transform the values before they are used (if that is necessary).\r\n\r\nWith that `Model\u003cPerson\u003e` you could do the following:\r\n\r\n```java\r\nPerson person = ... // create some person instance\r\n\r\nString string = personModel.toString(person); // create a generic string representation for person\r\n\r\nint comparison = personModel.compare(person, anotherPerson); // compare person with anotherPerson by comparing fields in the order they were defined (firstName, lastName, birthDate, mainAddress.street, mainAddress.houseNumber...)\r\n\r\npersonModel.get(person, Path.of(\"mainAddress\", \"city\")); // extract person.mainAddress.city\r\n\r\nDiff\u003cPerson\u003e diff = personModel.accept(new ComputeDiffModelVisitor\u003c\u003e(person, anotherPerson)); // returns a Diff\u003cPerson\u003e, see below for more explanation.\r\n```\r\n\r\n## The Diff interface\r\n\r\nThe `Diff\u003cT\u003e` interface represents the difference between two instances of `T` (left and right).\r\n\r\nA diff:\r\n- has a status in (`ADDED`, `REMOVED`, `UNCHANGED`, `MODIFIED`)\r\n- has left and right values of type `T`\r\n- can be visited by a `DiffVisitor\u003cT, R\u003e`\r\n\r\nA diff can be of one of the following concrete classes:\r\n- `SimpleDiff\u003cT\u003e` representing a diff between two atomic values of type `T`\r\n- `ListDiff\u003cC, E\u003e` representing a diff between two list-like values of type `C` containing elements of type `E`\r\n- `MapDiff\u003cM, K, V\u003e` representing a diff between two map-like values of type `M` containing entries with key of type `K` and value of type `V`\r\n- `BeanDiff\u003cB\u003e` representing a diff between two beans of type `B`\r\n\r\n### Basic example\r\n\r\n``` \r\nleft = President {\r\n\tfirstNames: ['George', 'Herbert', 'Walker'],\r\n\tlastName: 'Bush',\r\n\tbirthYear: 1924,\r\n\telectedYears: [1989]\r\n}\r\n\r\nright = President {\r\n\tfirstNames: ['George', 'Walker'],\r\n\tlastName: 'Bush',\r\n\tbirthYear: 1946,\r\n\telectedYears: [2001, 2005]\r\n}\r\n\r\ndiff(left, right) = BeanDiff\u003cPresident\u003e(status = MODIFIED, left = ..., right = ...) {\r\n\t'firstNames': ListDiff\u003cList\u003cString\u003e, String\u003e(status = MODIFIED, left = ..., right = ...) [\r\n\t\tSimpleDiff\u003cString\u003e(status = UNCHANGED, left = 'George', right = 'George'),\r\n\t\tSimpleDiff\u003cString\u003e(status = REMOVED, left = 'Herbert', right = null),\r\n\t\tSimpleDiff\u003cString\u003e(status = UNCHANGED, left = 'Walker', right = 'Walker'),\r\n\t],\r\n\t'lastName': SimpleDiff\u003cString\u003e(status = UNCHANGED, left = 'Bush', right = 'Bush'),\r\n\t'birthYear': SimpleDiff\u003cInteger\u003e(status = MODIFIED, left = 1924, right = 1946),\r\n\t'electedYears': ListDiff\u003cList\u003cInteger\u003e, Integer\u003e(status = MODIFIED, left = ..., right = ...) [\r\n\t\tSimpleDiff\u003cInteger\u003e(status = REMOVED, left = 1989, right = null),\r\n\t\tSimpleDiff\u003cInteger\u003e(status = ADDED, left = null, right = 2001),\r\n\t\tSimpleDiff\u003cInteger\u003e(status = ADDED, left = null, right = 2005),\r\n\t]\r\n}\r\n```\r\n\r\n## Paths\r\n\r\nA path object which can be used by both `Model` and `Diff` is also available:\r\n\r\n```java\r\nPath path = Path.of(\"previousAddresses\", 2, \"street\");\r\n\r\nPerson left = ...\r\nPerson right = ...\r\nModel\u003cPerson\u003e personModel = ...\r\nDiff\u003cPerson\u003e personDiff = personModel.diff(left, right);\r\n\r\nObject object = personModel.get(left, path); // extract value from left\r\nDiff\u003c?\u003e diff = personDiff.get(path); // extract diff\r\n```\r\n\r\n## Examples\r\n\r\nExamples can be found on the [codegeny-beans-examples repo](https://github.com/codegeny/codegeny-beans-examples).","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcodegeny%2Fcodegeny-beans","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcodegeny%2Fcodegeny-beans","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcodegeny%2Fcodegeny-beans/lists"}