@Test void testGetClasses() { assertThat(DeploymentDescriptorUtil.getClasses(this.classLoader, "normalDD"), containsInAnyOrder(Class1.class, Class2.class, Class3.class)); }
public static Set<Class<?>> getClasses(ClassLoader classLoader, String deploymentDescriptor) { Enumeration<URL> resources; try { resources = classLoader.getResources(deploymentDescriptor); } catch (IOException e) { throw new IllegalStateException("Could not read the deployment descriptor", e); } Set<Class<?>> classes = new HashSet<>(); while (resources.hasMoreElements()) { try (InputStream resourceAsStream = resources.nextElement().openStream(); BufferedReader reader = new BufferedReader( new InputStreamReader(resourceAsStream, StandardCharsets.UTF_8))) { String className; while ((className = reader.readLine()) != null) { if (className.isEmpty() || className.startsWith("#")) { continue; } classes.add(getClass(className, classLoader)); } } catch (IOException e) { throw new IllegalStateException("Could not read the deployment descriptor", e); } } return classes; }
DeploymentDescriptorUtil { public static Set<Class<?>> getClasses(ClassLoader classLoader, String deploymentDescriptor) { Enumeration<URL> resources; try { resources = classLoader.getResources(deploymentDescriptor); } catch (IOException e) { throw new IllegalStateException("Could not read the deployment descriptor", e); } Set<Class<?>> classes = new HashSet<>(); while (resources.hasMoreElements()) { try (InputStream resourceAsStream = resources.nextElement().openStream(); BufferedReader reader = new BufferedReader( new InputStreamReader(resourceAsStream, StandardCharsets.UTF_8))) { String className; while ((className = reader.readLine()) != null) { if (className.isEmpty() || className.startsWith("#")) { continue; } classes.add(getClass(className, classLoader)); } } catch (IOException e) { throw new IllegalStateException("Could not read the deployment descriptor", e); } } return classes; } }
DeploymentDescriptorUtil { public static Set<Class<?>> getClasses(ClassLoader classLoader, String deploymentDescriptor) { Enumeration<URL> resources; try { resources = classLoader.getResources(deploymentDescriptor); } catch (IOException e) { throw new IllegalStateException("Could not read the deployment descriptor", e); } Set<Class<?>> classes = new HashSet<>(); while (resources.hasMoreElements()) { try (InputStream resourceAsStream = resources.nextElement().openStream(); BufferedReader reader = new BufferedReader( new InputStreamReader(resourceAsStream, StandardCharsets.UTF_8))) { String className; while ((className = reader.readLine()) != null) { if (className.isEmpty() || className.startsWith("#")) { continue; } classes.add(getClass(className, classLoader)); } } catch (IOException e) { throw new IllegalStateException("Could not read the deployment descriptor", e); } } return classes; } private  DeploymentDescriptorUtil(); }
DeploymentDescriptorUtil { public static Set<Class<?>> getClasses(ClassLoader classLoader, String deploymentDescriptor) { Enumeration<URL> resources; try { resources = classLoader.getResources(deploymentDescriptor); } catch (IOException e) { throw new IllegalStateException("Could not read the deployment descriptor", e); } Set<Class<?>> classes = new HashSet<>(); while (resources.hasMoreElements()) { try (InputStream resourceAsStream = resources.nextElement().openStream(); BufferedReader reader = new BufferedReader( new InputStreamReader(resourceAsStream, StandardCharsets.UTF_8))) { String className; while ((className = reader.readLine()) != null) { if (className.isEmpty() || className.startsWith("#")) { continue; } classes.add(getClass(className, classLoader)); } } catch (IOException e) { throw new IllegalStateException("Could not read the deployment descriptor", e); } } return classes; } private  DeploymentDescriptorUtil(); static Set<Class<?>> getClasses(ClassLoader classLoader, String deploymentDescriptor); }
DeploymentDescriptorUtil { public static Set<Class<?>> getClasses(ClassLoader classLoader, String deploymentDescriptor) { Enumeration<URL> resources; try { resources = classLoader.getResources(deploymentDescriptor); } catch (IOException e) { throw new IllegalStateException("Could not read the deployment descriptor", e); } Set<Class<?>> classes = new HashSet<>(); while (resources.hasMoreElements()) { try (InputStream resourceAsStream = resources.nextElement().openStream(); BufferedReader reader = new BufferedReader( new InputStreamReader(resourceAsStream, StandardCharsets.UTF_8))) { String className; while ((className = reader.readLine()) != null) { if (className.isEmpty() || className.startsWith("#")) { continue; } classes.add(getClass(className, classLoader)); } } catch (IOException e) { throw new IllegalStateException("Could not read the deployment descriptor", e); } } return classes; } private  DeploymentDescriptorUtil(); static Set<Class<?>> getClasses(ClassLoader classLoader, String deploymentDescriptor);  }