/** * Constructs a new ShrinkWrapClassLoader for the specified {@link Archive}s using the default delegation parent * <code>ClassLoader</code>. The {@link Archive}s will be searched in the order specified for classes and resources * after first searching in the parent class loader. * * @param archives * the {@link Archive}s from which to load classes and resources */ public ShrinkWrapClassLoader(final Archive<?>... archives) { super(new URL[] {}); if (archives == null) { throw new IllegalArgumentException("Archives must be specified"); } addArchives(archives); }
/** * Constructs a new ShrinkWrapClassLoader for the given {@link Archive}s. The {@link Archive}s will be searched in * the order specified for classes and resources after first searching in the specified parent class loader. * * @param parent * the parent class loader for delegation * @param archives * the {@link Archive}s from which to load classes and resources */ public ShrinkWrapClassLoader(final ClassLoader parent, final Archive<?>... archives) { super(new URL[] {}, parent); if (archives == null) { throw new IllegalArgumentException("Archives must be specified"); } addArchives(archives); }
/** * Constructs a new ShrinkWrapClassLoader for the specified {@link Archive}s using the default delegation parent * <code>ClassLoader</code>. The {@link Archive}s will be searched in the order specified for classes and resources * after first searching in the parent class loader. Will assume classes are stored relative to the root of the archive. * * @param archives * the {@link Archive}s from which to load classes and resources */ public ShrinkWrapClassLoader(final Archive<?>... archives) { super(new URL[] {}); if (archives == null) { throw new IllegalArgumentException("Archives must be specified"); } addArchives(archives); this.classPrefix = ArchivePaths.root(); }
/** * Constructs a new ShrinkWrapClassLoader for the given {@link Archive}s. The {@link Archive}s will be searched in * the order specified for classes and resources after first searching in the specified parent class loader. * * @param parent * the parent class loader for delegation * @param classPrefix The location under which classes are located in the archive. For instance, * {@link org.jboss.shrinkwrap.api.spec.WebArchive} types store their classes under WEB-INF/classes. If * null, assumes the root * @param archives * the {@link Archive}s from which to load classes and resources */ public ShrinkWrapClassLoader(final ClassLoader parent, final String classPrefix, final Archive<?>... archives) { super(new URL[]{}, parent); if (archives == null) { throw new IllegalArgumentException("Archives must be specified"); } addArchives(archives); this.classPrefix = classPrefix == null ? ArchivePaths.root() : ArchivePaths.create(classPrefix); }