{"id":20741127,"url":"https://github.com/robtimus/string-template-utils","last_synced_at":"2025-09-27T18:31:13.987Z","repository":{"id":209889469,"uuid":"711189106","full_name":"robtimus/string-template-utils","owner":"robtimus","description":"A set of utility classes for working with string templates","archived":false,"fork":false,"pushed_at":"2024-01-20T12:51:44.000Z","size":17,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2024-11-17T06:41:50.210Z","etag":null,"topics":["java","string-template"],"latest_commit_sha":null,"homepage":"https://robtimus.github.io/string-template-utils/","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/robtimus.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-10-28T13:33:20.000Z","updated_at":"2023-12-20T15:32:59.000Z","dependencies_parsed_at":"2024-11-17T06:36:02.632Z","dependency_job_id":"9aa9748e-2a8f-4dca-ae9f-910b88bd152f","html_url":"https://github.com/robtimus/string-template-utils","commit_stats":null,"previous_names":["robtimus/string-template-utils"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/robtimus%2Fstring-template-utils","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/robtimus%2Fstring-template-utils/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/robtimus%2Fstring-template-utils/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/robtimus%2Fstring-template-utils/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/robtimus","download_url":"https://codeload.github.com/robtimus/string-template-utils/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":234452031,"owners_count":18834739,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","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":["java","string-template"],"created_at":"2024-11-17T06:34:00.345Z","updated_at":"2025-09-27T18:31:13.657Z","avatar_url":"https://github.com/robtimus.png","language":"Java","readme":"# string-template-utils\n[![Maven Central](https://img.shields.io/maven-central/v/com.github.robtimus/string-template-utils)](https://search.maven.org/artifact/com.github.robtimus/string-template-utils)\n[![Build Status](https://github.com/robtimus/string-template-utils/actions/workflows/build.yml/badge.svg)](https://github.com/robtimus/string-template-utils/actions/workflows/build.yml)\n[![Quality Gate Status](https://sonarcloud.io/api/project_badges/measure?project=com.github.robtimus%3Astring-template-utils\u0026metric=alert_status)](https://sonarcloud.io/summary/overall?id=com.github.robtimus%3Astring-template-utils)\n[![Coverage](https://sonarcloud.io/api/project_badges/measure?project=com.github.robtimus%3Astring-template-utils\u0026metric=coverage)](https://sonarcloud.io/summary/overall?id=com.github.robtimus%3Astring-template-utils)\n[![Known Vulnerabilities](https://snyk.io/test/github/robtimus/string-template-utils/badge.svg)](https://snyk.io/test/github/robtimus/string-template-utils)\n\nA set of utility classes for working with string templates.\n\n## StringTemplateProcessors\n\nClass `StringTemplateProcessors` can be used to easily construct string template processors that work like the default `STR` template processor, except they apply a function to the template values.\n\nFor instance, using [Apache Commons Text](https://commons.apache.org/proper/commons-text/):\n\n```java\nStringTemplate.Processor\u003cString, RuntimeException\u003e JSON = StringTemplateProcessors\n        .interpolateMapped(o -\u003e StringEscapeUtils.ESCAPE_JSON.translate(String.valueOf(o)));\nString json = JSON.\"\"\"\n    {\n      \"id\": \\{id},\n      \"name\": \"\\{name}\"\n    }\n    \"\"\";\n```\n\nOr equivalent, to prevent having to call `String.valueOf` explicitly:\n\n```java\nStringTemplate.Processor\u003cString, RuntimeException\u003e JSON = StringTemplateProcessors\n        .interpolateMappedAsString(s -\u003e StringEscapeUtils.ESCAPE_JSON.translate(s));\nString json = JSON.\"\"\"\n    {\n      \"id\": \\{id},\n      \"name\": \"\\{name}\"\n    }\n    \"\"\";\n```\n\nIn both cases, the `name` property will have a properly escaped value.\n\n## URLEncoderProcessor\n\nClass `URLEncoderProcessor` is a string template processor that uses [URLEncoder](https://docs.oracle.com/en/java/javase/21/docs/api/java.base/java/net/URLEncoder.html) for encoding template values. This makes it safe to use to create URIs. For example, using a static import:\n\n```java\nURI uri = encodeAsURI().\"https://host/path/\\{id}?url=\\{url}\";\n```\n\nIf `id` is `id/123` and `url` is `https://example.org?q=1`, the result will be `https://host/path/id%2F123?url=https%3A%2F%2Fexample.org%3Fq%3D1`.\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frobtimus%2Fstring-template-utils","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frobtimus%2Fstring-template-utils","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frobtimus%2Fstring-template-utils/lists"}