Return the path for the package of a class.
For example, if the class is java.lang.Object,
the path is java/lang.
509471
public static DocPath forPackage(Utils utils, TypeElement typeElement) {
        return (typeElement == null) ? empty : forPackage(utils.containingPackage(typeElement));
    }
1221137
synchronized public Set getClassesForPackage( String pack ) {
        insureInitialized();
        Set set = new HashSet();
        Collection c = (Collection)packageMap.get( pack );
        if ( c != null )
            set.addAll( c );

        if ( compPaths != null )
            for (int i=0; i<compPaths.size(); i++) {
                c = ((BshClassPath)compPaths.get(i)).getClassesForPackage(
                    pack );
                if ( c != null )
                    set.addAll( c );
            }
        return set;
    }
695327
public static String getPackage(Class<?> cls) {
        // cls.getPackage() sometimes returns null, in which case fall back to string massaging.
        java.lang.Package pkg = cls.isArray() ? cls.getComponentType().getPackage() : cls.getPackage();
        if ( pkg == null ) {
            int dotPos;
            int dolPos = cls.getName().indexOf( '$' );
            if ( dolPos > 0 ) {
                // we have nested classes, so adjust dotpos to before first $
                dotPos = cls.getName().substring( 0, dolPos ).lastIndexOf( '.' );
            } else {
                dotPos = cls.getName().lastIndexOf( '.' );
            }
                
            if ( dotPos > 0 ) {
                return cls.getName().substring( 0,
                                                dotPos );
            } else {
                // must be default package.
                return "";
            }
        } else {
            return pkg.getName();
        }
    }
687195
public static String getPackageName(String className) {
        int i = className.lastIndexOf(".");
        String packageName = "";
        if (i > -1) {
            packageName = className.substring(0, i);
        }
        return packageName;
    }
680135
public static String extractPackage(String classname) {
    if (classname.contains("."))
      return classname.substring(0, classname.lastIndexOf("."));
    else
      return DEFAULT_PACKAGE;
  }
988155
public function asPath()
    {
        if ($this->isClass() || $this->isInterface() || $this->isTrait() || $this->isException()) {
            return strtolower(str_replace('.', '/', str_replace('\\', '/', $this->_package)).'/'.$this->_name.'.html');
        } elseif ($this->isField()) {
            $class =& $this->containingClass();
            if ($class) {
                return strtolower(str_replace('.', '/', str_replace('\\', '/', $this->_package)).'/'.$class->name().'.html#').$this->_name;
            } else {
                return strtolower(str_replace('.', '/', str_replace('\\', '/', $this->_package)).'/package-globals.html#').$this->_name;
            }
        } elseif ($this->isConstructor() || $this->isMethod()) {
            $class =& $this->containingClass();
            if ($class) {
                return strtolower(str_replace('.', '/', str_replace('\\', '/', $this->_package)).'/'.$class->name().'.html#').$this->_name.'()';
            } else {
                return strtolower(str_replace('.', '/', str_replace('\\', '/', $this->_package)).'/package-functions.html#').$this->_name.'()';
            }
        } elseif ($this->isGlobal()) {
            return strtolower(str_replace('.', '/', str_replace('\\', '/', $this->_package)).'/package-globals.html#').$this->_name;
        } elseif ($this->isFunction()) {
            return strtolower(str_replace('.', '/', str_replace('\\', '/', $this->_package)).'/package-functions.html#').$this->_name.'()';
        }

        return NULL;
    }
1114857
public static String convertClassNameToResourcePath(String className) {
        Assert.notNull(className, "Class name must not be null");
        return className.replace(PACKAGE_SEPARATOR, PATH_SEPARATOR);
    }
1260981
def get_java_container(self, package_name=None, object_name=None, java_class_instance=None):
        
        if package_name is not None:
            jcontainer = self.import_scala_package_object(package_name)
        elif object_name is not None:
            jcontainer = self.import_scala_object(object_name)
        elif java_class_instance is not None:
            jcontainer = java_class_instance
        else:
            raise RuntimeError("Expected one of package_name, object_name or java_class_instance")
        return jcontainer
200262
public java.lang.String getPath() {
    java.lang.Object ref = path_;
    if (ref instanceof java.lang.String) {
      return (java.lang.String) ref;
    } else {
      com.google.protobuf.ByteString bs = 
          (com.google.protobuf.ByteString) ref;
      java.lang.String s = bs.toStringUtf8();
      if (bs.isValidUtf8()) {
        path_ = s;
      }
      return s;
    }
  }
1136179
def get_data_path(package, resource):
    # type: (str, str) -> str
    """"""
    loader = pkgutil.get_loader(package)
    if loader is None or not hasattr(loader, 'get_data'):
        raise PackageResourceError("Failed to load package: '{0}'".format(
            package))
    mod = sys.modules.get(package) or loader.load_module(package)
    if mod is None or not hasattr(mod, '__file__'):
        raise PackageResourceError("Failed to load module: '{0}'".format(
            package))
    parts = resource.split('/')
    parts.insert(0, os.path.dirname(mod.__file__))
    resource_name = os.path.join(*parts)
    return resource_name
262146
def _get_classpath():
    
    try:
        orig_cp = os.environ['CLASSPATH']
    except KeyError:
        return []
    expanded_cp = []
    for i in orig_cp.split(os.path.pathsep):
        expanded_cp.extend(_jar_glob(i))
    return expanded_cp
1276709
public static String getPackageName(Class<?> cls)
	{
		Package pkg;
		String str;
		int pos;

		if(cls == null)
			throw new NullPointerException("cls is null");
		if((pkg = cls.getPackage())!=null)
			return pkg.getName();
		str = cls.getName();
		if((pos = str.lastIndexOf('.'))>=0)
			return str.substring(0,pos);
		return "";	// default package
	}
575945
def get_notebook_rel_path(pkg=None):
    """"""
    pkg = pkg or open_source_package()
    pkg_path = str(pkg.package_url.fspath)
    nb_path = get_notebook_path()

    return nb_path.replace(pkg_path, '').strip('/')
543342
def _package_path(package):
    
    from os import path
    confdir = config_dir()
    return path.join(confdir, "{}.cfg".format(package))
548075
private Set<ClassInfo> findClassByPackage(final String packageName, final String packagePath,
                                              final Class<?> parent, final Class<? extends Annotation> annotation,
                                              final boolean recursive, Set<ClassInfo> classes) throws ClassNotFoundException {

        // Get the directory of this package to create a File
        File dir = new File(packagePath);
        // If not exist or is not a direct return to the directory
        if ((!dir.exists()) || (!dir.isDirectory())) {
            log.warn("The package [{}] not found.", packageName);
        }
        // If present, get all the files under the package include the directory
        File[] dirFiles = accept(dir, recursive);
        // Loop all files
        if (null != dirFiles && dirFiles.length > 0) {
            for (File file : dirFiles) {
                // If it is a directory, continue scanning
                if (file.isDirectory()) {
                    findClassByPackage(packageName + '.' + file.getName(), file.getAbsolutePath(), parent, annotation, recursive, classes);
                } else {
                    // If the java class file is removed later. Class only leave the class name
                    String   className = file.getName().substring(0, file.getName().length() - 6);
                    Class<?> clazz     = Class.forName(packageName + '.' + className);
                    if (null != parent && null != annotation) {
                        if (null != clazz.getSuperclass() && clazz.getSuperclass().equals(parent) &&
                                null != clazz.getAnnotation(annotation)) {
                            classes.add(new ClassInfo(clazz));
                        }
                        continue;
                    }
                    if (null != parent) {
                        if (null != clazz.getSuperclass() && clazz.getSuperclass().equals(parent)) {
                            classes.add(new ClassInfo(clazz));
                        } else {
                            if (null != clazz.getInterfaces() && clazz.getInterfaces().length > 0 && clazz.getInterfaces()[0].equals(parent)) {
                                classes.add(new ClassInfo(clazz));
                            }
                        }
                        continue;
                    }
                    if (null != annotation) {
                        if (null != clazz.getAnnotation(annotation)) {
                            classes.add(new ClassInfo(clazz));
                        }
                        continue;
                    }
                    classes.add(new ClassInfo(clazz));
                }
            }
        }
        return classes;
    }
1246391
@Pure
	public static Collection<Class<?>> getPackageClasses(String packageName) {
		final Collection<Class<?>> classes = new ArrayList<>();

		final String[] entries = System.getProperty("java.class.path") //$NON-NLS-1$
				.split(Pattern.quote(System.getProperty("path.separator"))); //$NON-NLS-1$
		String lentry;

		for (final String path : entries) {
			lentry = path.toLowerCase();
			if (lentry.endsWith(".jar") || lentry.endsWith(".war")) { //$NON-NLS-1$ //$NON-NLS-2$
				getPackageClassesFromJar(classes, path, packageName);
			} else {
				getPackageClassesFromFileSystem(classes, path, packageName);
			}

		}

		return classes;
	}
16326
public static String getClassPath(boolean isEncoded) {
		final URL classPathURL = getClassPathURL();
		String url = isEncoded ? classPathURL.getPath() : URLUtil.getDecodedPath(classPathURL);
		return FileUtil.normalize(url);
	}