Libraryless. Click here for Pure Java version (2247L/14K).
1 | static <A> A singleObjectMethodProxy2(Class<A> intrface, O object, S invokedMethodName, S targetMethodName) { |
2 | ret proxyFromInvocationHandler(intrface, new InvocationHandler { |
3 | public O invoke(O proxy, Method method, O[] args) { |
4 | S mname = method.getName(); |
5 | ifdef singleObjectMethodProxy2_debug |
6 | print("Proxy method called: " + mname + " " + toList(args)); |
7 | endifdef |
8 | if (mname.equals(invokedMethodName)) |
9 | ret call(object, targetMethodName, unnull(args)); |
10 | if (mname.equals("toString")) |
11 | ret "proxy for method " + targetMethodName; |
12 | null; |
13 | } |
14 | }); |
15 | } |
Began life as a copy of #1027670
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: | #1027674 |
Snippet name: | singleObjectMethodProxy2 - with 2 different method names |
Eternal ID of this version: | #1027674/1 |
Text MD5: | 8dcea9a0d72eee31467c8b5c24468ba6 |
Transpilation MD5: | 0ab700df25b77fd948c6187b457bf266 |
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:39:54 |
Source code size: | 622 bytes / 15 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 158 / 226 |
Referenced in: | [show references] |