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

17
LINES

< > BotCompany Repo | #1005268 - setOptAllDyn

JavaX fragment (include)

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 {
      o.fieldValues = syncMapPut2_createLinkedHashMap(o.fieldValues, intern(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   

Travelled to 11 computer(s): aoiabmzegqzx, cbybwowwnfue, cfunsshuasjs, ddnzoavkxhuk, gwrvuhgaqvyk, irmadwmeruwu, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, tslmcundralx, tvejysmllsmz

No comments. add comment

Snippet ID: #1005268
Snippet name: setOptAllDyn
Eternal ID of this version: #1005268/10
Text MD5: cbdefefabbdbaebbb52bb38ceb0948be
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2019-08-13 14:43:12
Source code size: 681 bytes / 17 lines
Pitched / IR pitched: No / No
Views / Downloads: 341 / 302
Version history: 9 change(s)
Referenced in: [show references]