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)

1  
static Map<Class, LS> fieldsInOrder_cache = weakHashMap();
2  
3  
static LS fieldsInOrder(O o) {
4  
  ret fieldsInOrder(_getClass(o));
5  
}
6  
7  
static LS fieldsInOrder(Class c) {
8  
  if (c == null) null;
9  
  synchronized(fieldsInOrder_cache) {
10  
    LS fields = fieldsInOrder_cache.get(c);
11  
    if (fields != null) ret fields;
12  
    S order = toStringOpt(getOpt(c, "_fieldOrder"));
13  
    Set<S> set = asTreeSet(allNonStaticFields(c));
14  
    if (order == null) ret asList(set);
15  
    fields = splitAtSpace(order);
16  
    setAddAll(fields, set); // TODO: optimize
17  
    fieldsInOrder_cache.put(c, fields);
18  
    ret fields;
19  
  }
20  
}

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: 344 / 371
Version history: 3 change(s)
Referenced in: [show references]