Libraryless. Click here for Pure Java version (2247L/14K).
1 | static <A> A singleObjectMethodProxy(Class<A> intrface, O object, S methodName) {
|
2 | ret proxyFromInvocationHandler(intrface, new InvocationHandler {
|
3 | public O invoke(O proxy, Method method, O[] args) {
|
4 | S mname = method.getName(); |
5 | ifdef singleObjectMethodProxy_debug |
6 | print("Proxy method called: " + mname + " " + toList(args));
|
7 | endifdef |
8 | if (mname.equals(methodName)) |
9 | ret call(object, methodName, unnull(args)); |
10 | if (mname.equals("toString"))
|
11 | ret "proxy for " + methodName; |
12 | null; |
13 | } |
14 | }); |
15 | } |
Began life as a copy of #1027669
download show line numbers debug dex old transpilations
Travelled to 7 computer(s): bhatertpkbcr, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tvejysmllsmz, vouqrxazstgt, xrpafgyirdlv
No comments. add comment
| Snippet ID: | #1027670 |
| Snippet name: | singleObjectMethodProxy |
| Eternal ID of this version: | #1027670/5 |
| Text MD5: | 874570ed448cd942112ca26463ae657b |
| Transpilation MD5: | 29746395eece4ddeafe524ce72c2acdd |
| Author: | stefan |
| Category: | javax |
| Type: | JavaX fragment (include) |
| Public (visible to everyone): | Yes |
| Archived (hidden from active list): | No |
| Created/modified: | 2020-03-29 23:36:31 |
| Source code size: | 567 bytes / 15 lines |
| Pitched / IR pitched: | No / No |
| Views / Downloads: | 426 / 565 |
| Version history: | 4 change(s) |
| Referenced in: | [show references] |