|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.mcdermottroe.exemplar.utils.Packages
public final class Packages
General purpose utility methods that can be used anywhere in the program.
| Field Summary | |
|---|---|
private static List<String> |
allPackages
Package discovery is an expensive operation so it is done once and the result is cached here. |
| Constructor Summary | |
|---|---|
private |
Packages()
Private constructor to prevent instantiation of this class. |
| Method Summary | |
|---|---|
private static List<String> |
findPackages()
Find the available packages in the classpath. |
static List<String> |
findSubPackages(String packageName)
Find all of the packages below a certain package. |
private static List<String> |
readPackagesFromDir(URL url,
String pkg)
Find the packages in a directory in a classpath. |
private static List<String> |
readPackagesFromJar(URL url)
Given a URL of a JAR file, read all of the packages contained
within it. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
private static List<String> allPackages
findPackages(),
findSubPackages(String)| Constructor Detail |
|---|
private Packages()
| Method Detail |
|---|
public static List<String> findSubPackages(String packageName)
packageName - The package to search below.
List of all of the sub-packages of the
given package, not including
packageName itself.private static List<String> findPackages()
allPackages after the first call.
ClassLoaderprivate static List<String> readPackagesFromJar(URL url)
URL of a JAR file, read all of the packages contained
within it.
url - The URL of the JAR file to read from.
List of packages contained within the JAR file.
private static List<String> readPackagesFromDir(URL url,
String pkg)
url - A URL pointing to the directory.pkg - The root package to find from.
List of packages found in the given directory.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||