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

20
LINES

< > BotCompany Repo | #1003453 // _getClass - finds class by name, casts to class or returns class of object

JavaX fragment (include)

1  
static Class<?> _getClass(String name) {
2  
  try {
3  
    ret Class.forName(name);
4  
  } catch (ClassNotFoundException e) {
5  
    null; // could optimize this
6  
  }
7  
}
8  
9  
static Class _getClass(O o) {
10  
  ret o == null ? null
11  
    : o instanceof Class ? (Class) o : o.getClass();
12  
}
13  
14  
static Class _getClass(O realm, S name) {
15  
  try {
16  
    ret classLoaderForObject(realm).loadClass(classNameToVM(name));
17  
  } catch (ClassNotFoundException e) {
18  
    null; // could optimize this
19  
  }
20  
}

Author comment

Began life as a copy of #1002776

download  show line numbers  debug dex  old transpilations   

Travelled to 22 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, ddnzoavkxhuk, gwrvuhgaqvyk, irmadwmeruwu, ishqpsrjomds, lpdgvwnxivlt, mowyntqkapby, mqqgnosmbjvj, onxytkatvevr, podlckwnjdmb, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, veepotesqksf, vouqrxazstgt, whxojlpjdney, wtqryiryparv, xrpafgyirdlv

No comments. add comment

Snippet ID: #1003453
Snippet name: _getClass - finds class by name, casts to class or returns class of object
Eternal ID of this version: #1003453/8
Text MD5: 714950c078cdc8a7cbb72b22a7f3ff95
Author: stefan
Category:
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2021-06-14 04:37:34
Source code size: 480 bytes / 20 lines
Pitched / IR pitched: No / No
Views / Downloads: 696 / 1165
Version history: 7 change(s)
Referenced in: [show references]