{"id":37028502,"url":"https://github.com/ccheptea/auto-value-node","last_synced_at":"2026-01-14T03:24:24.678Z","repository":{"id":57718138,"uuid":"84476636","full_name":"ccheptea/auto-value-node","owner":"ccheptea","description":"An AutoValue extension that makes properties in AutoValue classes accessible as nodes.","archived":false,"fork":false,"pushed_at":"2017-03-21T11:30:47.000Z","size":147,"stargazers_count":9,"open_issues_count":0,"forks_count":1,"subscribers_count":4,"default_branch":"master","last_synced_at":"2023-06-30T01:01:24.875Z","etag":null,"topics":["autovalue","null-check","optional"],"latest_commit_sha":null,"homepage":null,"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/ccheptea.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","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-03-09T18:44:01.000Z","updated_at":"2021-12-11T17:25:48.000Z","dependencies_parsed_at":"2022-09-10T15:02:23.605Z","dependency_job_id":null,"html_url":"https://github.com/ccheptea/auto-value-node","commit_stats":null,"previous_names":[],"tags_count":2,"template":null,"template_full_name":null,"purl":"pkg:github/ccheptea/auto-value-node","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ccheptea%2Fauto-value-node","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ccheptea%2Fauto-value-node/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ccheptea%2Fauto-value-node/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ccheptea%2Fauto-value-node/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ccheptea","download_url":"https://codeload.github.com/ccheptea/auto-value-node/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ccheptea%2Fauto-value-node/sbom","scorecard":{"id":269134,"data":{"date":"2025-08-11","repo":{"name":"github.com/ccheptea/auto-value-node","commit":"982681beff58ac701afecba788236be2343c5a17"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":2.9,"checks":[{"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":"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":"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":"Binary-Artifacts","score":9,"reason":"binaries present in source code","details":["Warn: binary detected: gradle/wrapper/gradle-wrapper.jar:1"],"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":"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":"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":"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":"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":"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":"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-17T12:54:52.309Z","repository_id":57718138,"created_at":"2025-08-17T12:54:52.309Z","updated_at":"2025-08-17T12:54:52.309Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28408834,"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":["autovalue","null-check","optional"],"created_at":"2026-01-14T03:24:24.006Z","updated_at":"2026-01-14T03:24:24.665Z","avatar_url":"https://github.com/ccheptea.png","language":"Java","readme":"# AutoValue: Node Extension [![Build Status](https://travis-ci.org/ccheptea/auto-value-node.svg?branch=master)](https://travis-ci.org/ccheptea/auto-value-node)\n\nAn extension for Google's [AutoValue](https://github.com/google/auto/tree/master/value) that:\n\n* Eliminates null checks when accessing AutoValue object fields;\n* Prevents ``NullPointerException``'s;\n* Increases code readability and maintainability (less if-else blocks);\n* Easier to read and understand than Java 8 Optionals\n* Works great with Lambdas;\n\n## Use case\n\nSuppose you have the following data structure:\n\n```\nCar\n    String model\n    Driver driver\n        String name\n        Club club\n            String title\n            Integer members\n            Contact contact\n                String email\n                String phone\n```\n\nLet's say you want to print the email for the club a car's driver is member of:\n\n```java\nSystem.out.println(car.driver().club().contact().email());\n```\n\nWhat if the car doesn't have a driver? Well, our code will break with a ``NullPointerException``. What if the car has \na driver that is not a member of any club. Or, what if the driver is member of a club, but its email is not listed?\nWe will have to check all those before printing. We will end up with this:\n\n```java\nif(car.driver()!=null \u0026\u0026 car.driver().club()!= null \u0026\u0026 car.driver().club().contact() != null){\n    System.out.println(car.driver().club().contact().email());\n}\n```\n\nThis works but it is hard to read and to maintain. And most likely you'll have plenty of places in your code where\nyou'll need to write similar checks.\n\nUsing **auto-value-node** the code above will become like this (assuming you use lambdas):\n\n```java \ncar.node().driver().club().contact().email().ifPresent(System.out::println);\n```\n\n## Usage\nIntegrating **auto-value-node** takes very little effort. First [add the dependencies][download], then add the following\nmethod to each AutoValue class:\n\n```java\npublic abstract Node_\u003cyour_class_name\u003e node();\n```\nMake sure to replace \"\u003cyour_class_name\u003e\" with the actual class name. That is all.\n\n### Node methods\n* ``withValue(Action1)`` executes an action with the value;\n* ``ifPresent(Action1)`` executes an action with the value if it is not ``null``, followed by\n    * ``otherwise(Action)`` executes an action if the value is ``null``;\n* ``ifAbsent(Action)`` executes an action if the value is ``null``, followed by\n    * ``otherwise(Acton1)`` applies an action on the value if it is not ``null``;\n* ``match(Predicate)`` returns a Node with the value if the predicate is true; a Node with null otherwise\n* ``map(Mapper)`` returns a mapped value defined by Mapper (e.g.: ``car.node().driver().club().map(Observable::just)`` == ``Observable.just(car.driver().club())``);\n* ``orAlernative(alternativeValue)`` returns a Node containing the value if it is not null; a Node with alternativeValue otherwise\n* ``isPresent()`` returns ``true`` if the value is not ``null``; ``false`` otherwise;\n* ``isAbsent()`` returns ``false`` if the value is not ``null``; ``true`` otherwise;\n* ``value()`` returns the value contained by the node;\n* ``value(alternativeValue)`` returns the value contained by the node if it is present; alternativeValue otherwise;\n\n## Download\n\n```groovy\nannotationProcessor 'com.ccheptea.auto.value:auto-value-node:0.2.8'\ncompile 'com.ccheptea.auto.value:auto-value-node-runtime:0.2.8'\n ```\n\nSnapshots of the development version are available in [Sonatype's `snapshots` repository][snap].\n\n## License\n\n\n```\nCopyright 2017 Constantin Cheptea.\n\nLicensed under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License.\nYou may obtain a copy of the License at\n\n   http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an \"AS IS\" BASIS,\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\nSee the License for the specific language governing permissions and\nlimitations under the License.\n```\n\n[snap]: https://oss.sonatype.org/content/repositories/snapshots/\n[download]: https://github.com/ccheptea/auto-value-node#download\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fccheptea%2Fauto-value-node","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fccheptea%2Fauto-value-node","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fccheptea%2Fauto-value-node/lists"}