public final class PackageUtils extends Object
| Modifier and Type | Method and Description |
|---|---|
static String |
getPackageName(Class<?> clazz)
Determines the package name from the given class object.
|
static String |
getPackageName(String qualifiedClassName)
Determines the package name from the given String(this must be the fully qualified class name
without the file extension).
|
static String |
getPackageNameWithDot(Class<?> clazz)
Determines the package name from the given class object and adds a dot at the end.
|
static String |
getPackagePath(Class<?> clazz)
Determines the package path from the given class object.
|
static String |
getPackagePath(Object object)
Determines the package path from the given object.
|
static String |
getPackagePathWithSlash(Class<?> clazz)
Determines the package path from the given object and adds a slash at the front.
|
static String |
getPackagePathWithSlash(Object object)
Determines the package path from the given object and adds a slash at the front.
|
static Set<String> |
scanClassNames(String packageName)
Scan class names from the given package name.
|
static Set<String> |
scanClassNames(String packageName,
boolean recursive,
boolean qualifiedClassnames)
Scan class names from the given package name.
|
public static String getPackageName(Class<?> clazz)
clazz - The class object.public static String getPackageName(String qualifiedClassName)
qualifiedClassName - The fully qualified class name without the file extension. For instance:
xy.ab.Test => xy.abpublic static String getPackageNameWithDot(Class<?> clazz)
clazz - The class object.public static String getPackagePath(Class<?> clazz)
clazz - The class object.public static String getPackagePath(Object object)
object - The object.public static String getPackagePathWithSlash(Class<?> clazz)
clazz - the clazzpublic static String getPackagePathWithSlash(Object object)
object - The object.public static Set<String> scanClassNames(String packageName) throws IOException
packageName - the package nameIOException - Signals that an I/O exception has occurred.public static Set<String> scanClassNames(String packageName, boolean recursive, boolean qualifiedClassnames) throws IOException
packageName - the package namerecursive - the recursive flagqualifiedClassnames - the flag if the class names should be qualified class names.IOException - Signals that an I/O exception has occurred.Copyright © 2007–2015 Alpha Ro Group UG (haftungsbeschrÀngt). All rights reserved.