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)

1  
svoid setOptAllDyn_pcall(DynamicObject o, MapSO fields) {
2  
  if (fields == null) ret;
3  
  HashMap<S, Field> fieldMap = instanceFieldsMap(o);
4  
  for (Map.Entry<S, O> e : fields.entrySet()) pcall {
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  
      o.fieldValues = syncMapPut2_createLinkedHashMap(o.fieldValues, intern(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 #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: 101 / 131
Referenced in: [show references]