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).

scope nonStaticNonTransientFieldObjects_cachedArray.

static Map<Class, Field[]> #cache = dangerousWeakMap();

static Field[] nonStaticNonTransientFieldObjects_cachedArray(O o) {
  if (o == null) null;
  Class c = _getClass(o);
  Field[] fields = cache.get(c);
  if (fields == null) {
    new L<Field> l;
    Class _c = c;
    do {
      for (Field f : _c.getDeclaredFields())
        if ((f.getModifiers() & (Modifier.STATIC | Modifier.TRANSIENT)) == 0)
          l.add(makeAccessible(f));
      _c = _c.getSuperclass();
    } while (_c != null);
    fields = toArrayOfType Field(l);
    cache.put(c, fields);
  }
  ret fields;
}

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: 181 / 972
Version history: 5 change(s)
Referenced in: #1006654 - Standard functions list 2 (LIVE, continuation of #761)
#1031755 - nonStaticNonPrimitiveNonTransientFieldObjects_cachedArray