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

10
LINES

< > BotCompany Repo | #1005271 // allFields - get field names including base classes. sorted by name

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

Libraryless. Click here for Pure Java version (3011L/17K).

static Map<Class, Set<S>> allFields_cache = weakHashMap();

static Set<S> allFields(O o) {
  if (o == null) ret emptySet();
  Class _c = _getClass(o);
  Set<S> fields = allFields_cache.get(_c);
  if (fields == null)
    allFields_cache.put(_c, fields = asTreeSet(keys(getOpt_getFieldMap(o))));
  return fields;
}

Author comment

Began life as a copy of #1001123

download  show line numbers  debug dex  old transpilations   

Travelled to 18 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, ddnzoavkxhuk, gwrvuhgaqvyk, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, onxytkatvevr, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, veepotesqksf, vouqrxazstgt, whxojlpjdney, wtqryiryparv

No comments. add comment

Snippet ID: #1005271
Snippet name: allFields - get field names including base classes. sorted by name
Eternal ID of this version: #1005271/6
Text MD5: 70529060f494b96031fef4f6ae3fd313
Transpilation MD5: fc7b988f5703ecaedb83138b26c4d489
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2021-07-10 16:07:37
Source code size: 321 bytes / 10 lines
Pitched / IR pitched: No / No
Views / Downloads: 675 / 1029
Version history: 5 change(s)
Referenced in: #1005341 - allFieldsAbove - get field names including base classes above a certain base class
#1005720 - allNonStaticFields - get field names including base classes
#1006654 - Standard functions list 2 (LIVE, continuation of #761)
#1009872 - fieldNames - synonym of allFields - get field names including base classes
#1013088 - allFieldObjects - get field objects including base classes