org.apache.wicket.util.lang
Class Packages

java.lang.Object
  extended by org.apache.wicket.util.lang.Packages

public final class Packages
extends Object

Utilities for dealing with packages.

Author:
Jonathan Locke, Niclas Hedhman

Method Summary
static String absolutePath(Class<?> p, String relativePath)
          Takes a package and a relative path to a resource and returns an absolute path to the resource.
static String absolutePath(Package p, String relativePath)
          Takes a package and a relative path to a resource and returns an absolute path to the resource.
static String absolutePath(String packageName, String relativePath)
          Takes a package and a relative path to a resource and returns an absolute path to the resource.
static String extractPackageName(Class<?> forClass)
          Determines the package name for the given class.
static String parent(String packageName)
          Gets the parent package name.
static String resolveScope(Class<?> forClass)
          Resolve scope for the given class by extracting it's package name and converting all dots to slashes.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

absolutePath

public static String absolutePath(Class<?> p,
                                  String relativePath)
Takes a package and a relative 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.

Parameters:
p - The package to start at
relativePath - The relative path to the class
Returns:
The absolute path

absolutePath

public static String absolutePath(Package p,
                                  String relativePath)
Takes a package and a relative 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.

Parameters:
p - The package to start at
relativePath - The relative path to the class
Returns:
The absolute path

absolutePath

public static String absolutePath(String packageName,
                                  String relativePath)
Takes a package and a relative 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.

Parameters:
packageName - The package to start at
relativePath - The relative path to the class
Returns:
The absolute path

extractPackageName

public static String extractPackageName(Class<?> forClass)
Determines the package name for the given class.

Parameters:
forClass - the class
Returns:
the package name

parent

public static String parent(String packageName)
Gets the parent package name.

Parameters:
packageName - The Package name
Returns:
The parent Package

resolveScope

public static String resolveScope(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


Copyright © 2004-2011 Apache Software Foundation. All Rights Reserved.