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

13
LINES

< > BotCompany Repo | #1013534 // ccopyFields - for concepts

JavaX fragment (include)

1  
static <A extends Concept> A ccopyFields(Concept x, A y, S... fields) {
2  
  if (x == null || y == null) ret y;
3  
  if (empty(fields)) { // assume we should copy all fields
4  
    for (S field : conceptFields(x))
5  
      cset(y, field, cget(x, field));
6  
  } else 
7  
    for (S field : fields) {
8  
      O o = cget(x, field);
9  
      if (o != null)
10  
        cset(y, field, o);
11  
    }
12  
  ret y;
13  
}

Author comment

Began life as a copy of #1002178

download  show line numbers  debug dex  old transpilations   

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

No comments. add comment

Snippet ID: #1013534
Snippet name: ccopyFields - for concepts
Eternal ID of this version: #1013534/5
Text MD5: fa2c9ad9f52970200286770c97f95a13
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2019-02-13 15:47:04
Source code size: 386 bytes / 13 lines
Pitched / IR pitched: No / No
Views / Downloads: 488 / 543
Version history: 4 change(s)
Referenced in: [show references]