Logo Search packages:      
Sourcecode: jamvm version File versions

Package [] java::lang::ClassLoader::getPackages (  )  [inline, protected]

Returns all Package objects defined by this classloader and its parents.

Returns:
an array of all defined packages
Since:
1.2

Definition at line 804 of file ClassLoader.java.

References definedPackages, getPackages(), and parent.

Referenced by getPackages().

  {
    // Get all our packages.
    Package[] packages;
    synchronized(definedPackages)
      {
        packages = new Package[definedPackages.size()];
        definedPackages.values().toArray(packages);
      }

    // If we have a parent get all packages defined by our parents.
    Package[] parentPackages;
    if (parent == null)
      parentPackages = VMClassLoader.getPackages();
    else
      parentPackages = parent.getPackages();

    Package[] allPackages = new Package[parentPackages.length
                              + packages.length];
    System.arraycopy(parentPackages, 0, allPackages, 0,
                     parentPackages.length);
    System.arraycopy(packages, 0, allPackages, parentPackages.length,
                     packages.length);
    return allPackages;
  }


Generated by  Doxygen 1.6.0   Back to index