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

20
LINES

< > BotCompany Repo | #1019761 // fieldsInOrder - try to rearrange class fields in source order

JavaX fragment (include)

static Map<Class, LS> fieldsInOrder_cache = weakHashMap();

static LS fieldsInOrder(O o) {
  ret fieldsInOrder(_getClass(o));
}

static LS fieldsInOrder(Class c) {
  if (c == null) null;
  synchronized(fieldsInOrder_cache) {
    LS fields = fieldsInOrder_cache.get(c);
    if (fields != null) ret fields;
    S order = toStringOpt(getOpt(c, "_fieldOrder"));
    Set<S> set = asTreeSet(allNonStaticFields(c));
    if (order == null) ret asList(set);
    fields = splitAtSpace(order);
    setAddAll(fields, set); // TODO: optimize
    fieldsInOrder_cache.put(c, fields);
    ret fields;
  }
}

Author comment

Began life as a copy of #1019416

download  show line numbers  debug dex  old transpilations   

Travelled to 10 computer(s): bhatertpkbcr, cfunsshuasjs, gwrvuhgaqvyk, irmadwmeruwu, ishqpsrjomds, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tvejysmllsmz, vouqrxazstgt

No comments. add comment

Snippet ID: #1019761
Snippet name: fieldsInOrder - try to rearrange class fields in source order
Eternal ID of this version: #1019761/4
Text MD5: 42d9bb615978c9a41517c3ac98475c03
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2018-11-25 02:30:15
Source code size: 609 bytes / 20 lines
Pitched / IR pitched: No / No
Views / Downloads: 342 / 368
Version history: 3 change(s)
Referenced in: [show references]