/** * A package of the specified class will be scanned and found classes will be added to the set of bean classes for the synthetic bean archive. * * @param scanRecursively * @param packageClass * @return self */ public Weld addPackage(boolean scanRecursively, Class<?> packageClass) { packages.add(new PackInfo(packageClass, scanRecursively)); return this; }
public URL getResourceUrl(ResourceLoader resourceLoader) { if (classLoaderRef != null) { return classLoaderRef.get().getResource(this.getPackClassName().replace('.', '/') + Files.CLASS_FILE_EXTENSION); } else { return resourceLoader.getResource(getPackName().replace('.', '/')); } }
String packName = packInfo.getPackName(); URL resourceUrl = packInfo.getResourceUrl(resourceLoader); if (packInfo.getPackClassName() == null) { handleDir(new File(resourceUri), packInfo.isScanRecursively(), packName, foundClasses); }else { handleDir(new File(resourceUri).getParentFile(), packInfo.isScanRecursively(), packName, foundClasses); handleJar(resourceUri, packInfo.isScanRecursively(), packName, foundClasses); } else { WeldSELogger.LOG.resourceUrlProtocolNotSupported(resourceUrl);
protected Set<String> scanPackages() { if (packages.isEmpty()) { return Collections.emptySet(); } Set<String> foundClasses = new HashSet<String>(); for (PackInfo packInfo : packages) { String packName = packInfo.getPackName(); URL resourceUrl = packInfo.getResourceUrl(resourceLoader); if (resourceUrl != null) { WeldSELogger.LOG.scanningPackage(packName, resourceUrl); try { URI resourceUri = resourceUrl.toURI(); if (PROCOTOL_FILE.equals(resourceUrl.getProtocol())) { File file = new File(resourceUri); handleDir(file.isDirectory() ? file : file.getParentFile(), packInfo.isScanRecursively(), packName, foundClasses); } else if (PROCOTOL_JAR.equals(resourceUrl.getProtocol())) { handleJar(resourceUri, packInfo.isScanRecursively(), packName, foundClasses); } else { WeldSELogger.LOG.resourceUrlProtocolNotSupported(resourceUrl); } } catch (URISyntaxException e) { CommonLogger.LOG.couldNotReadResource(resourceUrl, e); } } else { WeldSELogger.LOG.packageNotFound(packName); } } return foundClasses; }
protected Set<String> scanPackages() { if (packages.isEmpty()) { return Collections.emptySet(); } Set<String> foundClasses = new HashSet<String>(); for (PackInfo packInfo : packages) { String packName = packInfo.getPackName(); URL resourceUrl = packInfo.getResourceUrl(resourceLoader); if (resourceUrl != null) { WeldSELogger.LOG.scanningPackage(packName, resourceUrl); try { URI resourceUri = resourceUrl.toURI(); if (PROCOTOL_FILE.equals(resourceUrl.getProtocol())) { File file = new File(resourceUri); handleDir(file.isDirectory() ? file : file.getParentFile(), packInfo.isScanRecursively(), packName, foundClasses); } else if (PROCOTOL_JAR.equals(resourceUrl.getProtocol())) { handleJar(resourceUri, packInfo.isScanRecursively(), packName, foundClasses); } else { WeldSELogger.LOG.resourceUrlProtocolNotSupported(resourceUrl); } } catch (URISyntaxException e) { CommonLogger.LOG.couldNotReadResource(resourceUrl, e); } } else { WeldSELogger.LOG.packageNotFound(packName); } } return foundClasses; }
protected Set<String> scanPackages() { if (packages.isEmpty()) { return Collections.emptySet(); } Set<String> foundClasses = new HashSet<String>(); for (PackInfo packInfo : packages) { String packName = packInfo.getPackName(); URL resourceUrl = packInfo.getResourceUrl(resourceLoader); if (resourceUrl != null) { WeldSELogger.LOG.scanningPackage(packName, resourceUrl); try { URI resourceUri = resourceUrl.toURI(); if (PROCOTOL_FILE.equals(resourceUrl.getProtocol())) { File file = new File(resourceUri); handleDir(file.isDirectory() ? file : file.getParentFile(), packInfo.isScanRecursively(), packName, foundClasses); } else if (PROCOTOL_JAR.equals(resourceUrl.getProtocol())) { handleJar(resourceUri, packInfo.isScanRecursively(), packName, foundClasses); } else { WeldSELogger.LOG.resourceUrlProtocolNotSupported(resourceUrl); } } catch (URISyntaxException e) { CommonLogger.LOG.couldNotReadResource(resourceUrl, e); } } else { WeldSELogger.LOG.packageNotFound(packName); } } return foundClasses; }
/** * Provided Packages will be scanned and found classes will be added to the set of bean classes for the synthetic bean archive. * Also allows to choose whether or not the scanning should be recursive. * * @param scanRecursively indicates whether scanning process should be recursive * @param packages Packages to be scanned * @return self */ public Weld addPackages(boolean scanRecursively, Package... packages){ for (Package pack : packages) { this.packages.add(new PackInfo(pack, scanRecursively)); } return this; }
@Override public Weld addPackages(boolean scanRecursively, Package... packages) { for (Package pack : packages) { this.packages.add(new PackInfo(pack, scanRecursively)); } return this; }
/** * A package of the specified class will be scanned and found classes will be added to the set of bean classes for the synthetic bean archive. * * @param scanRecursively * @param packageClass * @return self */ public Weld addPackage(boolean scanRecursively, Class<?> packageClass) { packages.add(new PackInfo(packageClass, scanRecursively)); return this; }
@Override public Weld addPackages(boolean scanRecursively, Package... packages) { for (Package pack : packages) { this.packages.add(new PackInfo(pack, scanRecursively)); } return this; }
/** * A package of the specified class will be scanned and found classes will be added to the set of bean classes for the synthetic bean archive. * * @param scanRecursively * @param packageClass * @return self */ public Weld addPackage(boolean scanRecursively, Class<?> packageClass) { packages.add(new PackInfo(packageClass, scanRecursively)); return this; }
@Override public Weld addPackages(boolean scanRecursively, Package... packages) { for (Package pack : packages) { this.packages.add(new PackInfo(pack, scanRecursively)); } return this; }
public URL getResourceUrl(ResourceLoader resourceLoader) { if (classLoaderRef != null) { return classLoaderRef.get().getResource(this.getPackClassName().replace('.', '/') + Files.CLASS_FILE_EXTENSION); } else { return resourceLoader.getResource(getPackName().replace('.', '/')); } }
/** * A package of the specified class will be scanned and found classes will be added to the set of bean classes for the synthetic bean archive. * * @param scanRecursively * @param packageClass * @return self */ public Weld addPackage(boolean scanRecursively, Class<?> packageClass) { packages.add(new PackInfo(packageClass, scanRecursively)); return this; }
public URL getResourceUrl(ResourceLoader resourceLoader) { if (classLoaderRef != null) { return classLoaderRef.get().getResource(this.getPackClassName().replace('.', '/') + Files.CLASS_FILE_EXTENSION); } else { return resourceLoader.getResource(getPackName().replace('.', '/')); } }
public URL getResourceUrl(ResourceLoader resourceLoader) { if (classLoaderRef != null) { return classLoaderRef.get().getResource(this.getPackClassName().replace('.', '/') + Files.CLASS_FILE_EXTENSION); } else { return resourceLoader.getResource(getPackName().replace('.', '/')); } }