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

17
LINES

< > BotCompany Repo | #1030457 // setOptAllDyn_pcall [working backup]

JavaX fragment (include)

svoid setOptAllDyn_pcall(DynamicObject o, MapSO fields) {
  if (fields == null) ret;
  HashMap<S, Field> fieldMap = instanceFieldsMap(o);
  for (Map.Entry<S, O> e : fields.entrySet()) pcall {
    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 #1029607

download  show line numbers  debug dex  old transpilations   

Travelled to 4 computer(s): bhatertpkbcr, mqqgnosmbjvj, pyentgdyhuwx, vouqrxazstgt

No comments. add comment

Snippet ID: #1030457
Snippet name: setOptAllDyn_pcall [working backup]
Eternal ID of this version: #1030457/1
Text MD5: 00bdc8e280950bfdb5536785c19b7c8a
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2020-12-19 04:02:12
Source code size: 683 bytes / 17 lines
Pitched / IR pitched: No / No
Views / Downloads: 97 / 126
Referenced in: [show references]