public final class PackageExtensions extends Object
PackageExtensions.| Constructor and Description |
|---|
PackageExtensions() |
| 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 |
getPackagePath(String packagePathWithDots)
Determines the package path from the given String object that is in the dot-format.
|
static String |
getPackagePath(String packagePathWithDots,
boolean withEndSlash)
Determines the package path from the given String object that is in the dot-format.
|
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 getPackagePath(String packagePathWithDots)
packagePathWithDots - the package path with dotspublic static String getPackagePath(String packagePathWithDots, boolean withEndSlash)
packagePathWithDots - the package path with dotswithEndSlash - flag that indicates if a slash will be appended at the endpublic 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 © 2015–2018 Alpha Ro Group UG (haftungsbeschrÀngt). All rights reserved.