All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.sun.istack.tools.MaskingClassLoader Maven / Gradle / Ivy

Go to download

Old JAXB Binding Compiler. Contains source code needed for binding customization files into java sources. In other words: the *tool* to generate java classes for the given xml representation.

There is a newer version: 4.0.5
Show newest version
package com.sun.istack.tools;

import java.util.Collection;

/**
 * {@link ClassLoader} that masks a specified set of classes
 * from its parent class loader.
 *
 * 

* This code is used to create an isolated environment. * * @author Kohsuke Kawaguchi */ public class MaskingClassLoader extends ClassLoader { private final String[] masks; public MaskingClassLoader(String... masks) { this.masks = masks; } public MaskingClassLoader(Collection masks) { this(masks.toArray(new String[masks.size()])); } public MaskingClassLoader(ClassLoader parent, String... masks) { super(parent); this.masks = masks; } public MaskingClassLoader(ClassLoader parent, Collection masks) { this(parent, masks.toArray(new String[masks.size()])); } @Override protected synchronized Class loadClass(String name, boolean resolve) throws ClassNotFoundException { for (String mask : masks) { if(name.startsWith(mask)) throw new ClassNotFoundException(); } return super.loadClass(name, resolve); } }





© 2015 - 2025 Weber Informatics LLC | Privacy Policy