Mirror
A Java library that makes reflection easy
Install / Use
/learn @phase/MirrorREADME
mirror
A Java representation of jQuery, using Reflection to interact with things.
jQuery 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.
I 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!
##Use The first thing you want to do is statically import Mirror.java:
import static mirror.Mirror;
$() is the main method for mirror. It will get the class of what you input.
int i = 7;
$(i); //returns a ReflectedClass of type Integer
$(i).print(); //prints 'java.lang.Integer'
All of the classes implement a Printable interface, so you can put print() anywhere in your chain to debug.
To invoke a method:
String s = "Hello World";
String[] a = $(s).getMethod("split", String.class).invoke(" "); //returns s.split(" ")
You can also set and get fields:
String s = "Hello World";
$(s).setField("hash", -5);
int i = $(s).<Integer>getField("hash");
Related Skills
node-connect
342.5kDiagnose OpenClaw node connection and pairing failures for Android, iOS, and macOS companion apps
frontend-design
85.3kCreate distinctive, production-grade frontend interfaces with high design quality. Use this skill when the user asks to build web components, pages, or applications. Generates creative, polished code that avoids generic AI aesthetics.
openai-whisper-api
342.5kTranscribe audio via OpenAI Audio Transcriptions API (Whisper).
qqbot-media
342.5kQQBot 富媒体收发能力。使用 <qqmedia> 标签,系统根据文件扩展名自动识别类型(图片/语音/视频/文件)。
