saker.build Documentation TaskDoc JavaDoc Packages
public class WildcardFilteringClassLoader extends ClassLoader
ClassLoader implementation that only finds classes which have their name match the specified wildcards.

This classloader is constructed with a given classloader, and a set of wildcard names. When a class loading request is received, this classloader will examine the name of the to be loaded class, and check if any of the specified wildcards include it. If yes, then the specified parent classloader will be asked to load the class with the given name. If no matching wildcard found, then an appropriate exception will be thrown during class loading.

This classloader can be used to restrict access to classloader.

The ClassLoader.getParent() function of this class will always return null.

The wildcard mechanism works the same way as WildcardPath, but the '.' dot is considered to be the separactor character instead of the slash.

Use the static factory methods to create a new instance.

public static ClassLoader create(ClassLoader parent, Iterable<extends CharSequence> allowedpatterns) throws NullPointerException
Creates a new instance for the given parent classloader and allowed wildcard patterns.

If no allowed patterns are specified (i.e. empty iterable), null is returned.

parentThe parent classloader to delegate to.
allowedpatternsThe allowed patterns of class names. The patterns should be in dot separated format.
The classloader based on the arguments.
NullPointerExceptionIf any of the arguments, or patterns are null.
public static ClassLoader create(ClassLoader parent, CharSequence... allowedpatterns) throws NullPointerException
Creates a new instance for the given parent classloader and allowed wildcard patterns.

If no allowed patterns are specified (i.e. empty iterable), null is returned.

parentThe parent classloader to delegate to.
allowedpatternsThe allowed patterns of class names. The patterns should be in dot separated format.
The classloader based on the arguments.
NullPointerExceptionIf any of the arguments, or patterns are null.