Package org.apache.wicket.util.lang
Class Packages
- java.lang.Object
-
- org.apache.wicket.util.lang.Packages
-
public final class Packages extends java.lang.ObjectUtilities for dealing with packages.- Author:
- Jonathan Locke, Niclas Hedhman
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static java.lang.StringabsolutePath(java.lang.Class<?> p, java.lang.String path)Takes a package and a path to a resource and returns an absolute path to the resource.static java.lang.StringabsolutePath(java.lang.Package p, java.lang.String relativePath)Takes a package and a path to a resource and returns an absolute path to the resource.static java.lang.StringabsolutePath(java.lang.String packageName, java.lang.String path)Takes a package and a path to a resource and returns an absolute path to the resource.static java.lang.StringextractPackageName(java.lang.Class<?> forClass)Determines the package name for the given class.static java.lang.Stringparent(java.lang.String packageName)Gets the parent package name.static java.lang.StringresolveScope(java.lang.Class<?> forClass)Resolve scope for the given class by extracting it's package name and converting all dots to slashes.
-
-
-
Method Detail
-
absolutePath
public static java.lang.String absolutePath(java.lang.Class<?> p, java.lang.String path)Takes a package and a path to a resource and returns an absolute path to the resource.See
absolutePath(String, String)for details.- Parameters:
p- The package to start atpath- The path to the resource- Returns:
- The absolute path
-
absolutePath
public static java.lang.String absolutePath(java.lang.Package p, java.lang.String relativePath)Takes a package and a path to a resource and returns an absolute path to the resource.See
absolutePath(String, String)for details.- Parameters:
p- The package to start atrelativePath- The path to the resource- Returns:
- The absolute path
-
absolutePath
public static java.lang.String absolutePath(java.lang.String packageName, java.lang.String path)Takes a package and a path to a resource and returns an absolute path to the resource. For example, if the given package was java.lang and the relative path was "../util/List", then "java/util/List" would be returned. An already absolute path stays absolute.Note: The returned absolute path does not start with a slash ("/").
- Parameters:
packageName- The package to start atpath- The path to the resource- Returns:
- The absolute path
-
extractPackageName
public static java.lang.String extractPackageName(java.lang.Class<?> forClass)
Determines the package name for the given class.- Parameters:
forClass- the class- Returns:
- the package name
-
parent
public static java.lang.String parent(java.lang.String packageName)
Gets the parent package name.- Parameters:
packageName- The Package name- Returns:
- The parent Package
-
resolveScope
public static java.lang.String resolveScope(java.lang.Class<?> forClass)
Resolve scope for the given class by extracting it's package name and converting all dots to slashes.- Parameters:
forClass- the class- Returns:
- the scope string
-
-