Libraryless. Click here for Pure Java version (7538L/42K).
// TODO: better error message when neither field nor method found sO preciseGetOrCallMethod(O object, S name) { if (object == null) null; // could optimize more for sure if (canCallWithVarargs(object, name)) ret call(object, name); // TODO: better error message when neither field nor method found ret _get(object, name); }
download show line numbers debug dex old transpilations
Travelled to 3 computer(s): bhatertpkbcr, mowyntqkapby, mqqgnosmbjvj
No comments. add comment
Snippet ID: | #1035088 |
Snippet name: | preciseGetOrCallMethod |
Eternal ID of this version: | #1035088/3 |
Text MD5: | e508bdc362d52de4edadc29804047423 |
Transpilation MD5: | 06293548edaa20c640bd73299187fa09 |
Author: | stefan |
Category: | javax / reflection |
Type: | JavaX fragment (include) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2022-03-29 20:56:47 |
Source code size: | 357 bytes / 12 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 142 / 205 |
Version history: | 2 change(s) |
Referenced in: | [show references] |