Returns the package path of a class.

@param clasz
Class to determine the path for - Cannot be <code>null</code>.

@return Package path for the class.
353963
public static String getPackagePath(final Class<?> clasz) {
        checkNotNull("clasz", clasz);
        return clasz.getPackage().getName().replace('.', '/');
    }
760538
public static String packageNameOf(Class<?> clazz) {
        String name = clazz.getName();
        int pos = name.lastIndexOf('.');
        E.unexpectedIf(pos < 0, "Class does not have package: " + name);
        return name.substring(0, pos);
    }
9837
public static <T> Clazz<T> FindClazz( Class<T> clazz )
	{
		return impl.FindClazz( clazz );
	}
70400
public static ClassInfo classInfo(final ClassLoader cl, final Class<?> clasz) {
        return classInfo(cl, clasz.getName());
    }
306402
public static String getTypeName(Class<?> clazz) {
		Type typeAnnotation = clazz.getAnnotation(Type.class);
		return typeAnnotation != null ? typeAnnotation.value() : null;
	}
543868
private static String which(Class clazz) {
        try {
            String classnameAsResource = clazz.getName().replace('.', '/') + ".class";

            ClassLoader loader = clazz.getClassLoader();

            URL it;

            if (loader != null) {
                it = loader.getResource(classnameAsResource);
            } else {
                it = ClassLoader.getSystemResource(classnameAsResource);
            }

            if (it != null) {
                return it.toString();
            }
        }
        // The VM ran out of memory or there was some other serious problem. Re-throw.
        catch (VirtualMachineError vme) {
            throw vme;
        }
        // ThreadDeath should always be re-thrown
        catch (ThreadDeath td) {
            throw td;
        }
        catch (Throwable t) {
            // work defensively.
            if (debug) {
                t.printStackTrace();
            }
        }
        return "unknown location";
    }
954320
public static PropertyFile get(Class<?> clazz)
	{
		try
		{
			// If we get a guice-enhanced class then we should go up one level to get the class name from the user's code
			if (clazz.getName().contains("$$EnhancerByGuice$$"))
				clazz = clazz.getSuperclass();

			final String classFileName = clazz.getSimpleName() + ".class";
			final String classFilePathAndName = clazz.getName().replace('.', '/') + ".class";

			URL url = clazz.getResource(classFileName);

			if (log.isTraceEnabled())
				log.trace("getResource(" + classFileName + ") = " + url);

			if (url == null)
			{
				return null;
			}
			else
			{
				String classesUrl = url.toString();

				// Get the classes base
				classesUrl = classesUrl.replace(classFilePathAndName, "");

				// Special-case: classes in a webapp are at /WEB-INF/classes/ rather than /
				if (classesUrl.endsWith("WEB-INF/classes/"))
				{
					classesUrl = classesUrl.replace("WEB-INF/classes/", "");
				}

				final URL manifestURL = new URL(classesUrl + "META-INF/MANIFEST.MF");

				try
				{
					final InputStream is = manifestURL.openStream();

					try
					{
						final PropertyFile props = new PropertyFile();
						final Manifest manifest = new Manifest(is);

						for (Object key : manifest.getMainAttributes().keySet())
						{
							final Object value = manifest.getMainAttributes().get(key);

							props.set(key.toString(), value.toString());
						}

						return props;
					}
					finally
					{
						IOUtils.closeQuietly(is);
					}
				}
				catch (FileNotFoundException e)
				{
					log.warn("Could not find: " + manifestURL, e);

					return null;
				}
			}
		}
		catch (Throwable t)
		{
			log.warn("Error acquiring MANIFEST.MF for " + clazz, t);

			return null;
		}
	}
31376
public static String getSourcePathForClass(Class clazz, String defaultValue) {

	try {

	    String result = clazz.getProtectionDomain().getCodeSource().getLocation().getPath();
	    result = URLDecoder.decode(result, CharsetUtil.UTF8.name());
	    result = SystemUtil.fixWindowsPath(result);
	    return result;
	}
	catch (Throwable t) {
	    ExceptionUtil.rethrowIfNecessary(t);
	}

	return defaultValue;
    }
687195
public static String getPackageName(String className) {
        int i = className.lastIndexOf(".");
        String packageName = "";
        if (i > -1) {
            packageName = className.substring(0, i);
        }
        return packageName;
    }
250645
public static URL findClassBase(Class clazz)
   {
      String resource = clazz.getName().replace('.', '/') + ".class";
      return findResourceBase(resource, clazz.getClassLoader());
   }
1288315
public final void addClass(final SgClass clasz) {
        if (clasz == null) {
            throw new IllegalArgumentException("The argument 'clasz' cannot be null!");
        }
        if (!classes.contains(clasz)) {
            classes.add(clasz);
        }
    }
263307
public static ImportSet getASBoxImports (Class<?> clazz)
    {
        ImportSet imports = new ImportSet();
        boxASArgumentAndGatherImports(clazz, "foo", imports);
        return imports;
    }
263131
public static String getQualifiedName(Class<?> clazz) {
		Assert.notNull(clazz, "Class must not be null");
		if (clazz.isArray()) {
			return getQualifiedNameForArray(clazz);
		}
		else {
			return clazz.getName();
		}
	}
167826
public static String getDescriptor(final Class<?> clazz) {
    StringBuilder stringBuilder = new StringBuilder();
    appendDescriptor(stringBuilder, clazz);
    return stringBuilder.toString();
  }
299573
public static String classpathFromClass(Class<?> clazz) {
        String aname = clazz.getPackage().getName().replaceAll("\\.", "/") + "/" +  clazz.getSimpleName()+".class";
        String apath = ClassLoader.getSystemClassLoader().getResource( aname).getPath();
        String path = null;
        if (apath.contains("!")) {
            path = apath.substring(0, apath.indexOf("!")).replace("file:", "");
        } else {
            path = apath.substring(0, apath.indexOf(aname));
        }
        return path;
    }
250399
public static String getClassPath(Class<?> c) {
		String strClassFullName = c.getName();
		String strClassName = strClassFullName.substring(strClassFullName
				.lastIndexOf(".") + 1);
		String strClassPathName = getClassPathName(c);

		ClassLoader cl = c.getClassLoader();
		if (cl == null) {
			cl = ClassLoader.getSystemClassLoader();
			return null;
		}

		URL urlClass = cl.getResource(strClassPathName);
		if (urlClass == null)
			return null;

		String strUrl = urlClass.toString();
		return strUrl.substring(0, strUrl.lastIndexOf(strClassName));
	}
740945
public static String getScriptName(Class<?> clazz) {
        return clazz == null ? null : getScriptName(clazz.getName());
    }