{"id":28828014,"url":"https://github.com/openrewrite/rewrite-templating","last_synced_at":"2026-03-04T18:05:18.196Z","repository":{"id":103599195,"uuid":"571715460","full_name":"openrewrite/rewrite-templating","owner":"openrewrite","description":"Automated templating using code snippets.","archived":false,"fork":false,"pushed_at":"2026-01-30T01:20:56.000Z","size":1307,"stargazers_count":16,"open_issues_count":5,"forks_count":8,"subscribers_count":7,"default_branch":"main","last_synced_at":"2026-01-30T02:39:28.275Z","etag":null,"topics":[],"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/openrewrite.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,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2022-11-28T18:26:43.000Z","updated_at":"2026-01-30T01:20:59.000Z","dependencies_parsed_at":null,"dependency_job_id":"36755932-825b-4887-a883-d5273eb54815","html_url":"https://github.com/openrewrite/rewrite-templating","commit_stats":null,"previous_names":[],"tags_count":103,"template":false,"template_full_name":null,"purl":"pkg:github/openrewrite/rewrite-templating","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/openrewrite%2Frewrite-templating","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/openrewrite%2Frewrite-templating/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/openrewrite%2Frewrite-templating/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/openrewrite%2Frewrite-templating/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/openrewrite","download_url":"https://codeload.github.com/openrewrite/rewrite-templating/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/openrewrite%2Frewrite-templating/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29331641,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-11T06:13:03.264Z","status":"ssl_error","status_checked_at":"2026-02-11T06:12:55.843Z","response_time":97,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"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":[],"created_at":"2025-06-19T04:44:12.868Z","updated_at":"2026-02-11T10:06:00.093Z","avatar_url":"https://github.com/openrewrite.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003cp align=\"center\"\u003e\n  \u003ca href=\"https://docs.openrewrite.org\"\u003e\n    \u003cpicture\u003e\n      \u003csource media=\"(prefers-color-scheme: dark)\" srcset=\"https://github.com/openrewrite/rewrite/raw/main/doc/logo-oss-dark.svg\"\u003e\n      \u003csource media=\"(prefers-color-scheme: light)\" srcset=\"https://github.com/openrewrite/rewrite/raw/main/doc/logo-oss-light.svg\"\u003e\n      \u003cimg alt=\"OpenRewrite Logo\" src=\"https://github.com/openrewrite/rewrite/raw/main/doc/logo-oss-light.svg\" width='600px'\u003e\n    \u003c/picture\u003e\n  \u003c/a\u003e\n\u003c/p\u003e\n\n\u003cdiv align=\"center\"\u003e\n  \u003ch1\u003erewrite-templating\u003c/h1\u003e\n\u003c/div\u003e\n\n\u003cdiv align=\"center\"\u003e\n\n\u003c!-- Keep the gap above this line, otherwise they won't render correctly! --\u003e\n[![ci](https://github.com/openrewrite/rewrite-templating/actions/workflows/ci.yml/badge.svg)](https://github.com/openrewrite/rewrite-templating/actions/workflows/ci.yml)\n[![Apache 2.0](https://img.shields.io/github/license/openrewrite/rewrite-templating.svg)](https://www.apache.org/licenses/LICENSE-2.0)\n[![Maven Central](https://img.shields.io/maven-central/v/org.openrewrite/rewrite-templating.svg)](https://mvnrepository.com/artifact/org.openrewrite/rewrite-templating)\n[![Revved up by Develocity](https://img.shields.io/badge/Revved%20up%20by-Develocity-06A0CE?logo=Gradle\u0026labelColor=02303A)](https://ge.openrewrite.org/scans)\n[![Contributing Guide](https://img.shields.io/badge/Contributing-Guide-informational)](https://github.com/openrewrite/.github/blob/main/CONTRIBUTING.md)\n\u003c/div\u003e\n\n### What is this?\n\nSupport before/after templating as seen in Google Refaster.\n\n### Input\n\nAllows you to defined one or more `@BeforeTemplate` annotated methods and a single `@AfterTemplate` method.\n\n```java\npackage foo;\n\nimport com.google.errorprone.refaster.annotation.AfterTemplate;\nimport com.google.errorprone.refaster.annotation.BeforeTemplate;\n\npublic class UseStringIsEmpty {\n    @BeforeTemplate\n    boolean before(String s) {\n        return s.length() \u003e 0;\n    }\n\n    @AfterTemplate\n    boolean after(String s) {\n        return !s.isEmpty();\n    }\n}\n```\n\n### Output\n\nThis results in a recipe that can be used to transform code that matches the `@BeforeTemplate` to the `@AfterTemplate`.\n\n## Options\nAnnotation processors can take options to customize their behavior. Options are passed to the annotation processor via the `-A` flag.\n\n### Change the `@Generated` annotation\nBy default, the annotation processor will add a `@javax.annotation.Generated` annotation to the generated classes, compatible with Java 8.\nOn newer Java version you'd perhaps want to pass in the following option:\n```\n-Arewrite.generatedAnnotation=jakarta.annotation.Generated\n```\n\n### Use JavaParser.Builder `.classpathFromResources(ctx, \"guava-31\")`\nBy default, the annotation processor will use `JavaParser.runtimeClasspath()` to resolve the classpath for newly generated Java code snippets.\nIf you want to use `TypeTables` from `src/main/resources/META-INF/rewrite/classpath.tsv.gz` instead, pass in the following option:\n```\n-Arewrite.javaParserClasspathFrom=resources\n```\n\n## Contributing\n\nWe appreciate all types of contributions. See the [contributing guide](https://github.com/openrewrite/.github/blob/main/CONTRIBUTING.md) for detailed instructions on how to get started.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fopenrewrite%2Frewrite-templating","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fopenrewrite%2Frewrite-templating","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fopenrewrite%2Frewrite-templating/lists"}