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

17
LINES

< > BotCompany Repo | #1005268 // setOptAllDyn - sets real or dynamic fields

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

Libraryless. Click here for Pure Java version (3013L/18K).

1  
static void setOptAllDyn(DynamicObject o, Map<S, O> fields) {
2  
  if (fields == null) ret;
3  
  HashMap<S, Field> fieldMap = instanceFieldsMap(o);
4  
  for (Map.Entry<S, O> e : fields.entrySet()) {
5  
    S field = e.getKey();
6  
    O val = e.getValue();
7  
    bool has = fieldMap.containsKey(field);
8  
    if (has)
9  
      setOpt(o, field, val);
10  
    else {
11  
      dynamicObject_setRawFieldValue(o, field, val);
12  
      ifdef setOptAllDyn_debug
13  
        print("setOptAllDyn added dyn " + field + " to " + o + " [value: " + val + ", fieldValues = " + systemHashCode(o.fieldValues) + ", " + struct(keys(o.fieldValues)) + "]");
14  
      endifdef
15  
    }
16  
  }
17  
}

Author comment

Began life as a copy of #1004782

download  show line numbers  debug dex  old transpilations   

Travelled to 15 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, ddnzoavkxhuk, gwrvuhgaqvyk, irmadwmeruwu, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt

No comments. add comment

Snippet ID: #1005268
Snippet name: setOptAllDyn - sets real or dynamic fields
Eternal ID of this version: #1005268/12
Text MD5: ce9777256f2fbf18fb410efb988ec74a
Transpilation MD5: ffb4504650b384334416cdd324f6f4a5
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2021-06-22 00:25:05
Source code size: 644 bytes / 17 lines
Pitched / IR pitched: No / No
Views / Downloads: 642 / 685
Version history: 11 change(s)
Referenced in: [show references]