Libraryless. Click here for Pure Java version (3805L/22K).
1 | static Map<S, Class> classForName_cache = synchroHashMap(); |
2 | |
3 | static Class classForName(S name, O classFinder default null) { |
4 | // first clause is when we're in class init |
5 | if (classForName_cache == null || classFinder != null) |
6 | ret classForName_uncached(name, classFinder); |
7 | Class c = classForName_cache.get(name); |
8 | if (c == null) |
9 | classForName_cache.put(name, c = classForName_uncached(name, null)); |
10 | ret c; |
11 | } |
12 | |
13 | static Class classForName_uncached(S name, O classFinder) ctex { |
14 | if (classFinder != null) ret (Class) callF(classFinder, name); |
15 | ret Class.forName(name); |
16 | } |
download show line numbers debug dex old transpilations
Travelled to 13 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt
No comments. add comment
Snippet ID: | #1011694 |
Snippet name: | classForName - cached version of Class.forName; should be a lot faster |
Eternal ID of this version: | #1011694/8 |
Text MD5: | 13b538239b0b860a60558324cf5edb84 |
Transpilation MD5: | 248ca98b9a9dd81a41d090b6248b6489 |
Author: | stefan |
Category: | javax |
Type: | JavaX fragment (include) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2021-09-12 01:20:50 |
Source code size: | 595 bytes / 16 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 731 / 886 |
Version history: | 7 change(s) |
Referenced in: | [show references] |