{"id":27958057,"url":"https://github.com/ericsson/proxy","last_synced_at":"2026-01-07T11:16:00.693Z","repository":{"id":41369340,"uuid":"131018650","full_name":"Ericsson/proxy","owner":"Ericsson","description":"Powerful interception library that lets you at runtime change the behavior of objects and classes","archived":false,"fork":false,"pushed_at":"2025-01-27T14:38:26.000Z","size":606,"stargazers_count":42,"open_issues_count":0,"forks_count":12,"subscribers_count":14,"default_branch":"master","last_synced_at":"2025-05-07T18:16:02.100Z","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":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Ericsson.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","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":"2018-04-25T14:25:21.000Z","updated_at":"2025-03-31T10:54:08.000Z","dependencies_parsed_at":"2023-10-04T13:57:30.711Z","dependency_job_id":null,"html_url":"https://github.com/Ericsson/proxy","commit_stats":null,"previous_names":[],"tags_count":29,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Ericsson%2Fproxy","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Ericsson%2Fproxy/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Ericsson%2Fproxy/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Ericsson%2Fproxy/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Ericsson","download_url":"https://codeload.github.com/Ericsson/proxy/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":252931507,"owners_count":21827112,"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":[],"created_at":"2025-05-07T18:16:09.067Z","updated_at":"2026-01-07T11:16:00.610Z","avatar_url":"https://github.com/Ericsson.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003c!---\nCopyright (c) 2018 Ericsson\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\nSOFTWARE. SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n---\u003e\n[![Build Status](https://travis-ci.org/Ericsson/proxy.svg?branch=master)](https://travis-ci.org/Ericsson/proxy)\n[![license](https://img.shields.io/github/license/mashape/apistatus.svg)](https://github.com/Ericsson/proxy)\n[![maven](https://img.shields.io/badge/maven-site-green.svg)](https://ericsson.github.io/proxy/)\n\n# Proxy\nA small yet powerful interception library that lets you manipulate existing objects and classes behavior runtime, \nIt's achieving this by using [javassist](http://jboss-javassist.github.io/javassist/) to do bytecode manipulation,\nProxy has a [fluent](http://en.wikipedia.org/wiki/Fluent_interface) interception API:\n\n```java\npackage examples;\n\nimport static com.ericsson.commonlibrary.proxy.Proxy.with;\n\npublic class FluentExample {\n\n    public static class SomeImpl { //sample class\n\n        public void log(String log) {\n            System.out.println(log);\n        }\n    }\n\n    public static void main(String[] args) throws SecurityException, NoSuchMethodException {\n\n        //lambda on class\n        SomeImpl obj = with(SomeImpl.class)\n                .interceptAll(i -\u003e {\n                    System.out.println(\"before method: \" + i.getMethodName() + \" param: \" + i.getParameter0());\n                    return i.invoke();\n                }).get();\n        obj.log(\"123\");\n        //Console output:\n        //        before method: log param: 123\n        //        123\n\n        //lambda on object\n        SomeImpl obj2 = with(new SomeImpl())\n                .interceptAll(i -\u003e {\n                    Object result = i.invoke();\n                    System.out.println(\"after method: \" + i.getMethodName() + \" param: \" + i.getParameter0());\n                    return result;\n                }).get();\n        obj2.log(\"321\");\n        //Console output:\n        //        321\n        //        after method: log param: 321\n\n        //lambda without return.\n        SomeImpl obj3 = with(SomeImpl.class)\n                .interceptAll((i) -\u003e System.out.println(\"Replace method invocation: \" + i.getMethodName()))\n                .get();\n        obj3.log(\"12345\");\n        //Console output:\n        //        Replace method invocation: log\n    }\n}\n\n```\n## What is Proxy and why use it?\n\nProxy is a highly general-purpose library that solve a typical Java development problem (Runtime change of behavior for classes and objects) that no other open source solution does today.\nProxy is powerful interception library that lets you manipulate existing objects and classes(by internally using bytecode manipulation). \n\nUsing Proxy can allow you to architecturally implement your code completely differently using it’s features like:\n\n* Building complex object from small objects.\n* Create simple java beans objects without providing an implementation.\n* Dynamically change an interface of an object (duck typing)\n* Replacing an existing object with modified version.\n* [Mixin](https://en.wikipedia.org/wiki/Mixin) / multiple inheritance functionality. (Not present in Java by default)\n* [AOP](https://en.wikipedia.org/wiki/Aspect-oriented_programming) like features.\n\nProxy is a great building block for creating other innovative solutions.\n\n## Alternative Solutions\n* Proxy like functionality is already included in Java itself but **limited to interfaces only** which is often not enough.\n  * Often referred to as JDK dynamic proxies\n  * https://docs.oracle.com/javase/8/docs/technotes/guides/reflection/proxy.html \n* [AspectJ](http://www.eclipse.org/aspectj/doc/next/progguide/) very powerful but requires special plugins and learn a new _language_ \n  * Great at static interception done **during compilation**\n  * Is missing most of the **runtime** features of Proxy.\n* [Spring-AOP](https://docs.spring.io/spring/docs/current/spring-framework-reference/core.html#aop-api )\n  * Proxy is much more lightweight in comparison.\n  * It does bytecode manipulation with cglib similarly to how Proxy does the same with Javassist\n  * It is missing features like: __recursive interception__ and __delegation__ and **object interception**\n\n## User Guide \n**Under Construction**:  https://ericsson.github.io/proxy\n\n## How to Propose Changes\nAnyone is welcome to propose changes to this repository by creating a new [Issue](https://github.com/Ericsson/proxy/issues) ticket in GitHub. These requests may concern anything contained in the repo: changes to documentation, changes to interfaces, changes to implementations, additional tests et cetera.\n\nWhen posting a new issue, try to be as precise as possible and phrase your arguments for your request carefully. Keep in mind that collaborative software development is often an exercise in finding workable compromises between multiple and often conflicting needs. In particular, pay attention to the following:\n1. What type of change is requested?\n1. Why would you like to see this change?\n1. Can you provide any concrete examples?\n1. Which arguments in favor can you think of?\n1. Which arguments against can you think of, and why are they outweighed by the arguments in favor?\n\nAlso, keep in mind that just as anyone is welcome to propose a change, anyone is welcome to disagree with and criticize that proposal.\n\n## How to Contribute\nWhile we welcome requests for changes (in the form of Issues), we absolutely love ready solutions (in the form of Pull Requests). The best requests are the ones with Pull Requests to go along with them.\n\nContributions can be made by anyone using the standard [GitHub Fork and Pull model](https://help.github.com/articles/about-pull-requests). When making a pull request, keep a few things in mind.\n1. Always explicitly connect a pull request to an Issue. See How to Propose Changes above for further information.\n1. Pull Requests will be publicly reviewed, criticized, and potentially rejected. Don't take it personally.\n\n## [License](./LICENSE.md)\n\n**Proxy** is licensed under the [MIT License](https://opensource.org/licenses/MIT).\n\n## [Code of Conduct](./CODE_OF_CONDUCT.md)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fericsson%2Fproxy","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fericsson%2Fproxy","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fericsson%2Fproxy/lists"}