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)

static Class<?> _getClass(String name) {
  try {
    ret Class.forName(name);
  } catch (ClassNotFoundException e) {
    null; // could optimize this
  }
}

static Class _getClass(O o) {
  ret o == null ? null
    : o instanceof Class ? (Class) o : o.getClass();
}

static Class _getClass(O realm, S name) {
  try {
    ret classLoaderForObject(realm).loadClass(classNameToVM(name));
  } catch (ClassNotFoundException e) {
    null; // could optimize this
  }
}

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