Not logged in.  Login/Logout/Register | List snippets | | Create snippet | Upload image | Upload data

11
LINES

< > BotCompany Repo | #1003492 // proxy - make an implementation of an interface forwarding calls to any object

JavaX fragment (include) [tags: use-pretranspiled]

Libraryless. Click here for Pure Java version (2519L/16K).

static <A> A nuLike proxy(Class<A> intrface, final O target) {
  if (target == null) null;
  if (isInstance(intrface, target)) ret (A) target;
  ret (A) java.lang.reflect.Proxy.newProxyInstance(intrface.getClassLoader(),
    new Class[] { intrface },
    new proxy_InvocationHandler(target));
}

static <A> A proxy(O target, Class<A> intrface) {
  ret proxy(intrface, target);
}

download  show line numbers  debug dex  old transpilations   

Travelled to 15 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, ddnzoavkxhuk, gwrvuhgaqvyk, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt, xrpafgyirdlv

No comments. add comment

Snippet ID: #1003492
Snippet name: proxy - make an implementation of an interface forwarding calls to any object
Eternal ID of this version: #1003492/8
Text MD5: 8887fc429e261ebae5a2788b34dae905
Transpilation MD5: fe21239f8f154d3eb65eae5f3e708932
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2020-09-23 11:24:41
Source code size: 388 bytes / 11 lines
Pitched / IR pitched: No / No
Views / Downloads: 623 / 718
Version history: 7 change(s)
Referenced in: [show references]