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

12
LINES

< > BotCompany Repo | #1024663 // safeUnstructureAllowingCertainClasses_plusUtils - safe-unstructure, but allowing a few main$ and loadableUtils.utils$ classes

JavaX fragment (include)

sO safeUnstructureAllowingCertainClasses_plusUtils(S s, S... allowedClasses) {
  new Set<S> allowedClassesSet;
  fOr (S name : allowedClasses) {
    allowedClassesSet.add("main$" + name);
    allowedClassesSet.add("loadableUtils.utils$" + name);
  }
  O classFinder = func(S name) {
    if (!allowedClassesSet.contains(name)) fail("Class not allowed to unstructure: " + name);
    ret classForName(name);
  };
  ret unstructure(s, false, classFinder);
}

Author comment

Began life as a copy of #1020506

download  show line numbers  debug dex  old transpilations   

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

No comments. add comment

Snippet ID: #1024663
Snippet name: safeUnstructureAllowingCertainClasses_plusUtils - safe-unstructure, but allowing a few main$ and loadableUtils.utils$ classes
Eternal ID of this version: #1024663/6
Text MD5: f4583fcc5aab4572bc1422989402672d
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2019-08-25 14:56:22
Source code size: 464 bytes / 12 lines
Pitched / IR pitched: No / No
Views / Downloads: 160 / 197
Version history: 5 change(s)
Referenced in: [show references]