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)

static O shallowExport(O o, O dest) {
  if (o == null || o instanceof String || o instanceof Number || o instanceof Collection || o instanceof Map || isArray(o)) ret o;

  Class c = o.getClass();
  S className = c.getName();
  Class destClass = getClass_vmName(dest, className);
  if (destClass == c) ret o;
  ret shallowCloneToClass(destClass, o);
}

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: 255 / 269
Referenced in: [show references]