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 getClass(realm).getClassLoader().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   

Travelled to 19 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, ddnzoavkxhuk, gwrvuhgaqvyk, irmadwmeruwu, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, onxytkatvevr, podlckwnjdmb, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, 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/7
Text MD5: b20f890798a3a7db72315ef3cec70593
Author: stefan
Category:
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2018-10-29 12:01:25
Source code size: 485 bytes / 20 lines
Pitched / IR pitched: No / No
Views / Downloads: 381 / 791
Version history: 6 change(s)
Referenced in: [show references]

Formerly at http://tinybrain.de/1003453 & http://1003453.tinybrain.de