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).

1  
// We even allow overriding existing interface implementations
2  
static <A> A nuLike lookupDynamicInterface(Class<A> intrface, O o) {
3  
  if (o cast DynamicObject)
4  
    try object A a = cast mapGet((Map) o.fieldValues, intrface);
5  
  if (isInstance(intrface, o)) ret (A) o;
6  
  null;
7  
}
8  
9  
10  
static <A> A nuLike lookupDynamicInterface(O o, Class<A> intrface) {
11  
  ret lookupDynamicInterface(intrface, o);
12  
}

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: 209 / 282
Version history: 7 change(s)
Referenced in: [show references]