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

8
LINES

< > BotCompany Repo | #1020506 // safeUnstructureAllowingCertainClasses - safe-unstructure, but allowing a few main$ classes

JavaX fragment (include)

static <A> A safeUnstructureAllowingCertainClasses(S s, S... allowedClasses) {
  final Set<S> allowedClassesSet = asSet(map(allowedClasses, func(S name) -> S { "main$" + name }));
  O classFinder = func(S name) {
    if (!allowedClassesSet.contains(name)) fail("Class not allowed to unstructure: " + name);
    ret classForName(name);
  };
  ret (A) unstructure(s, false, classFinder);
}

Author comment

Began life as a copy of #1006909

download  show line numbers  debug dex  old transpilations   

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

No comments. add comment

Snippet ID: #1020506
Snippet name: safeUnstructureAllowingCertainClasses - safe-unstructure, but allowing a few main$ classes
Eternal ID of this version: #1020506/1
Text MD5: d7cdfba7ceb79a8b92bf4518841a2394
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2018-12-25 16:46:16
Source code size: 394 bytes / 8 lines
Pitched / IR pitched: No / No
Views / Downloads: 190 / 220
Referenced in: [show references]