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

9
LINES

< > BotCompany Repo | #1021089 // shallowExport - export an object to another realm (copy first level only)

JavaX fragment (include)

1  
static O shallowExport(O o, O dest) {
2  
  if (o == null || o instanceof String || o instanceof Number || o instanceof Collection || o instanceof Map || isArray(o)) ret o;
3  
4  
  Class c = o.getClass();
5  
  S className = c.getName();
6  
  Class destClass = getClass_vmName(dest, className);
7  
  if (destClass == c) ret o;
8  
  ret shallowCloneToClass(destClass, o);
9  
}

Author comment

Began life as a copy of #1002777

download  show line numbers  debug dex  old transpilations   

Travelled to 7 computer(s): bhatertpkbcr, cfunsshuasjs, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tvejysmllsmz, vouqrxazstgt

No comments. add comment

Snippet ID: #1021089
Snippet name: shallowExport - export an object to another realm (copy first level only)
Eternal ID of this version: #1021089/1
Text MD5: 23036bbbc30fd630acd1f7d15ae99e26
Author: stefan
Category: eleu / nl
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2019-01-22 14:34:26
Source code size: 358 bytes / 9 lines
Pitched / IR pitched: No / No
Views / Downloads: 342 / 346
Referenced in: [show references]