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

32
LINES

< > BotCompany Repo | #1020759 // callFInRealOrMyMC - callF + adjust for real main class [now just a synonym of callF since string functions are discontinued]

JavaX fragment (include)

1  
ifclass F0
2  
  static <A> A callFInRealOrMyMC(O realm, F0<A> f) {
3  
    ret f == null ? null : f.get();
4  
  }
5  
endif
6  
7  
ifclass F1
8  
  static <A, B> B callFInRealOrMyMC(O realm, F1<A, B> f, A a) {
9  
    ret f == null ? null : f.get(a);
10  
  }
11  
endif
12  
13  
ifclass F2
14  
  static <A, B, C> C callFInRealOrMyMC(O realm, F2<A, B, C> f, A a, B b) {
15  
    ret f == null ? null : f.get(a, b);
16  
  }
17  
endif
18  
19  
ifclass VF1
20  
  static <A> void callFInRealOrMyMC(O realm, VF1<A> f, A a) {
21  
    if (f != null) f.get(a);
22  
  }
23  
endif
24  
25  
static O callFInRealOrMyMC(O realm, O f, O... args) {
26  
  if (f cast S) {
27  
    Class mc = getMainClass(realm);
28  
    if (hasMethod(mc, f, args))
29  
      ret call(mc, f, args);
30  
  }
31  
  ret callF(f, args);
32  
}

Author comment

Began life as a copy of #1020757

download  show line numbers  debug dex  old transpilations   

Travelled to 7 computer(s): bhatertpkbcr, cfunsshuasjs, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tvejysmllsmz, vouqrxazstgt

No comments. add comment

Snippet ID: #1020759
Snippet name: callFInRealOrMyMC - callF + adjust for real main class [now just a synonym of callF since string functions are discontinued]
Eternal ID of this version: #1020759/3
Text MD5: 4538dc3ce59ba78b11233d2753e0762d
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2021-10-26 12:40:13
Source code size: 712 bytes / 32 lines
Pitched / IR pitched: No / No
Views / Downloads: 268 / 309
Version history: 2 change(s)
Referenced in: [show references]