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

24
LINES

< > BotCompany Repo | #1031066 // nonStaticNonTransientFieldObjects_cachedArray

JavaX fragment (include) [tags: use-pretranspiled]

Libraryless. Click here for Pure Java version (2751L/16K).

1  
scope nonStaticNonTransientFieldObjects_cachedArray.
2  
3  
static Map<Class, Field[]> #cache = dangerousWeakMap();
4  
5  
static Field[] nonStaticNonTransientFieldObjects_cachedArray(O o) {
6  
  if (o == null) null;
7  
  Class c = _getClass(o);
8  
  Field[] fields = cache.get(c);
9  
  if (fields == null) {
10  
    new L<Field> l;
11  
    Class _c = c;
12  
    do {
13  
      for (Field f : _c.getDeclaredFields())
14  
        if ((f.getModifiers() & (Modifier.STATIC | Modifier.TRANSIENT)) == 0)
15  
          l.add(makeAccessible(f));
16  
      _c = _c.getSuperclass();
17  
    } while (_c != null);
18  
    fields = toArrayOfType Field(l);
19  
    cache.put(c, fields);
20  
  }
21  
  ret fields;
22  
}
23  
24  
end scope

Author comment

Began life as a copy of #1025413

download  show line numbers  debug dex  old transpilations   

Travelled to 6 computer(s): bhatertpkbcr, ekrmjmnbrukm, mqqgnosmbjvj, onxytkatvevr, pyentgdyhuwx, vouqrxazstgt

No comments. add comment

Snippet ID: #1031066
Snippet name: nonStaticNonTransientFieldObjects_cachedArray
Eternal ID of this version: #1031066/6
Text MD5: c15c25a8b022c76daaf42891b60ad7c1
Transpilation MD5: f5e93d5226420eaab8b959b61ddd82fa
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2021-04-26 18:29:07
Source code size: 664 bytes / 24 lines
Pitched / IR pitched: No / No
Views / Downloads: 182 / 973
Version history: 5 change(s)
Referenced in: [show references]