{"id":16871692,"url":"https://github.com/phase/mirror","last_synced_at":"2025-04-11T10:43:16.328Z","repository":{"id":27411092,"uuid":"30888010","full_name":"phase/mirror","owner":"phase","description":"A Java library that makes reflection easy","archived":false,"fork":false,"pushed_at":"2015-04-14T18:37:33.000Z","size":240,"stargazers_count":8,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-25T07:11:33.433Z","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/phase.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}},"created_at":"2015-02-16T20:58:25.000Z","updated_at":"2022-04-29T14:30:13.000Z","dependencies_parsed_at":"2022-08-07T12:16:38.304Z","dependency_job_id":null,"html_url":"https://github.com/phase/mirror","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/phase%2Fmirror","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/phase%2Fmirror/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/phase%2Fmirror/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/phase%2Fmirror/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/phase","download_url":"https://codeload.github.com/phase/mirror/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248378375,"owners_count":21093983,"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":"2024-10-13T15:09:28.483Z","updated_at":"2025-04-11T10:43:16.290Z","avatar_url":"https://github.com/phase.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"# mirror\nA Java representation of jQuery, using Reflection to interact with things.\n\njQuery is used to interact with the DOM in JavaScript. Java doesn't have a DOM, so the next best thing was Reflection, which interacts with everything in Java.\n\nI recently found out `$` could be used as an identifier in Java, and I immediately thought of jQuery. jQuery messes with the DOM, Relfection messes with Classes. Put two and two together and we've got mirror!\n\n##Use\nThe first thing you want to do is statically import Mirror.java:\n```java\nimport static mirror.Mirror;\n```\n`$()` is the main method for mirror. It will get the class of what you input.\n```java\nint i = 7;\n$(i); //returns a ReflectedClass of type Integer\n\n$(i).print(); //prints 'java.lang.Integer'\n```\nAll of the classes implement a Printable interface, so you can put `print()` anywhere in your chain to debug.\n\nTo invoke a method:\n```java\nString s = \"Hello World\";\nString[] a = $(s).getMethod(\"split\", String.class).invoke(\" \"); //returns s.split(\" \")\n```\n\nYou can also set and get fields:\n```java\nString s = \"Hello World\";\n$(s).setField(\"hash\", -5);\nint i = $(s).\u003cInteger\u003egetField(\"hash\");\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fphase%2Fmirror","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fphase%2Fmirror","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fphase%2Fmirror/lists"}