View Javadoc

1   package delight.nashornsandbox.internal;
2   
3   import java.util.Set;
4   import jdk.nashorn.api.scripting.ClassFilter;
5   
6   @SuppressWarnings("all")
7   public class SandboxClassFilter implements ClassFilter {
8     private final Set<String> allowed;
9     
10    @Override
11    public boolean exposeToScripts(final String className) {
12      return this.allowed.contains(className);
13    }
14    
15    public SandboxClassFilter(final Set<String> allowed) {
16      this.allowed = allowed;
17    }
18  }