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

11
LINES

< > BotCompany Repo | #1027672 // forwardSwappableFunctionToObject

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

Libraryless. Click here for Pure Java version (2487L/15K).

svoid forwardSwappableFunctionToObject(O o, S swappableMethodName, O target) {
  forwardSwappableFunctionToObject(o, swappableMethodName, target, swappableMethodName);
}

svoid forwardSwappableFunctionToObject(O o, S swappableMethodName, O target, S methodNameOnTarget) {
  if (o == null || target == null) ret;
  Class type = fieldType(o, swappableMethodName);
  if (type == null) ret; // field doesn't exist
  S proxyMethodName = type == Runnable.class ? "run" : "get";
  set(o, swappableMethodName, singleObjectMethodProxy2(type, target, proxyMethodName, methodNameOnTarget));
}

Author comment

Began life as a copy of #1027671

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: #1027672
Snippet name: forwardSwappableFunctionToObject
Eternal ID of this version: #1027672/5
Text MD5: 9afe6b3001623e4780b6a3dc5bcaf7b8
Transpilation MD5: 5a3f478d7610ee9e47854cd8e49fab98
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:41:35
Source code size: 591 bytes / 11 lines
Pitched / IR pitched: No / No
Views / Downloads: 215 / 299
Version history: 4 change(s)
Referenced in: [show references]