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

static void setOptAllDyn(DynamicObject o, Map<S, O> fields) {
  if (fields == null) ret;
  HashMap<S, Field> fieldMap = instanceFieldsMap(o);
  for (Map.Entry<S, O> e : fields.entrySet()) {
    S field = e.getKey();
    O val = e.getValue();
    bool has = fieldMap.containsKey(field);
    if (has)
      setOpt(o, field, val);
    else {
      dynamicObject_setRawFieldValue(o, field, val);
      ifdef setOptAllDyn_debug
        print("setOptAllDyn added dyn " + field + " to " + o + " [value: " + val + ", fieldValues = " + systemHashCode(o.fieldValues) + ", " + struct(keys(o.fieldValues)) + "]");
      endifdef
    }
  }
}

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: 640 / 681
Version history: 11 change(s)
Referenced in: [show references]