{"id":20741121,"url":"https://github.com/robtimus/obfuscation-commons-lang","last_synced_at":"2026-06-04T17:31:12.639Z","repository":{"id":57722469,"uuid":"260905087","full_name":"robtimus/obfuscation-commons-lang","owner":"robtimus","description":"Provides functionality for obfuscating objects using Apache Commons Lang","archived":false,"fork":false,"pushed_at":"2024-01-20T12:52:34.000Z","size":595,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-01-18T01:45:19.619Z","etag":null,"topics":["commons","commons-lang","java","obfuscation"],"latest_commit_sha":null,"homepage":"https://robtimus.github.io/obfuscation-commons-lang","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":"2020-05-03T12:05:11.000Z","updated_at":"2024-02-13T11:40:38.000Z","dependencies_parsed_at":"2023-02-15T17:45:44.033Z","dependency_job_id":"a6efaa52-621d-4ea3-9ead-309acfaf589c","html_url":"https://github.com/robtimus/obfuscation-commons-lang","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/robtimus%2Fobfuscation-commons-lang","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/robtimus%2Fobfuscation-commons-lang/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/robtimus%2Fobfuscation-commons-lang/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/robtimus%2Fobfuscation-commons-lang/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/robtimus","download_url":"https://codeload.github.com/robtimus/obfuscation-commons-lang/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243030805,"owners_count":20224666,"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":["commons","commons-lang","java","obfuscation"],"created_at":"2024-11-17T06:33:56.501Z","updated_at":"2025-03-11T12:10:06.205Z","avatar_url":"https://github.com/robtimus.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"# obfuscation-commons-lang\n[![Maven Central](https://img.shields.io/maven-central/v/com.github.robtimus/obfuscation-commons-lang)](https://search.maven.org/artifact/com.github.robtimus/obfuscation-commons-lang)\n[![Build Status](https://github.com/robtimus/obfuscation-commons-lang/actions/workflows/build.yml/badge.svg)](https://github.com/robtimus/obfuscation-commons-lang/actions/workflows/build.yml)\n[![Quality Gate Status](https://sonarcloud.io/api/project_badges/measure?project=com.github.robtimus%3Aobfuscation-commons-lang\u0026metric=alert_status)](https://sonarcloud.io/summary/overall?id=com.github.robtimus%3Aobfuscation-commons-lang)\n[![Coverage](https://sonarcloud.io/api/project_badges/measure?project=com.github.robtimus%3Aobfuscation-commons-lang\u0026metric=coverage)](https://sonarcloud.io/summary/overall?id=com.github.robtimus%3Aobfuscation-commons-lang)\n[![Known Vulnerabilities](https://snyk.io/test/github/robtimus/obfuscation-commons-lang/badge.svg)](https://snyk.io/test/github/robtimus/obfuscation-commons-lang)\n\nProvides extensions to [Apache Commons Lang](https://commons.apache.org/proper/commons-lang/) for obfuscating objects.\n\nCurrently it has one extension: an obfuscating [ToStringStyle](https://commons.apache.org/proper/commons-lang/javadocs/api-release/org/apache/commons/lang3/builder/ToStringStyle.html). This can obfuscate fields when used with [ToStringBuilder](https://commons.apache.org/proper/commons-lang/javadocs/api-release/org/apache/commons/lang3/builder/ToStringBuilder.html) or similar classes.\n\nTo create an obfuscating `ToStringStyle`, use one of the factory methods of class \n[ObfuscatingToStringStyle](https://robtimus.github.io/obfuscation-commons-lang/apidocs/com/github/robtimus/obfuscation/commons/lang3/ObfuscatingToStringStyle.html) to create a builder, add fields, and build the result. For instance, using the default style:\n\n    ToStringStyle style = ObfuscatingToStringStyle.defaultStyle()\n            .withField(\"password\", Obfuscator.fixedLength(3))\n            .build();\n\n## Available styles\n\nMost of the styles available in Apache Commons Lang 3 are available, including the recursive and multi-line recursive style. The only style that has been omitted is the [JSON toString style](https://commons.apache.org/proper/commons-lang/javadocs/api-release/org/apache/commons/lang3/builder/ToStringStyle.html#JSON_STYLE).\n\n## Immutability\n\nMost of the styles available in Apache Commons Lang 3 are all immutable. The same cannot be said for the obfuscating styles, they are not immutable and not thread-safe. Reusing the same instance should not be done concurrently (reusing it in the same thread should be possible).\n\nHowever, it is possible to create immutable _suppliers_ instead:\n\n    Supplier\u003c? extends ToStringStyle\u003e styleSupplier = ObfuscatingToStringStyle.defaultStyle()\n            .withField(\"password\", Obfuscator.fixedLength(3))\n            .supplier();\n\nThe difference between using `build()` and using `supplier()` is that `supplier()` is more light-weight if you need to create multiple styles with the same settings. Such a supplier can be used directly or using `ThreadLocal`. For instance, in a class:\n\n    private static final Supplier\u003c? extends ToStringStyle\u003e TO_STRING_STYLE = ObfuscatingToStringStyle.defaultStyle()\n            ...\n            .supplier();\n    \n    ...\n    \n    @Override\n    public String toString() {\n        return ToStringBuilder.reflectionToString(this, TO_STRING_STYLE.get());\n    }\n\n## Serializability\n\nObfuscating `ToStringStyle` instances are serializable if the obfuscators they use are. This most often means that they are not serializable, even though most `ToStringStyle` implementations are.\n\n## Extending ObfuscatingToStringStyle\n\nSee [examples](https://github.com/robtimus/obfuscation-commons-lang/tree/master/src/examples/java/com/github/robtimus/obfuscation/commons/lang3/extending) for some examples. These include both an example that simply reuses [ObfuscatingToStringStyle.Builder](https://robtimus.github.io/obfuscation-commons-lang/apidocs/com/github/robtimus/obfuscation/commons/lang3/ObfuscatingToStringStyle.Builder.html), and one that provides a builder with more properties.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frobtimus%2Fobfuscation-commons-lang","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frobtimus%2Fobfuscation-commons-lang","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frobtimus%2Fobfuscation-commons-lang/lists"}