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

12
LINES

< > BotCompany Repo | #1031190 // lookupDynamicInterface

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

Libraryless. Click here for Pure Java version (121L/1K).

// We even allow overriding existing interface implementations
static <A> A nuLike lookupDynamicInterface(Class<A> intrface, O o) {
  if (o cast DynamicObject)
    try object A a = cast mapGet((Map) o.fieldValues, intrface);
  if (isInstance(intrface, o)) ret (A) o;
  null;
}


static <A> A nuLike lookupDynamicInterface(O o, Class<A> intrface) {
  ret lookupDynamicInterface(intrface, o);
}

download  show line numbers  debug dex  old transpilations   

Travelled to 4 computer(s): bhatertpkbcr, mqqgnosmbjvj, pyentgdyhuwx, vouqrxazstgt

No comments. add comment

Snippet ID: #1031190
Snippet name: lookupDynamicInterface
Eternal ID of this version: #1031190/8
Text MD5: 710ac8ca2766726744036b6385f13088
Transpilation MD5: ac8259a9623ae4d1f0288c38ff07f21e
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2021-05-19 23:24:21
Source code size: 399 bytes / 12 lines
Pitched / IR pitched: No / No
Views / Downloads: 111 / 177
Version history: 7 change(s)
Referenced in: [show references]