Logo Search packages:      
Sourcecode: jamvm version File versions

Package java::lang::ClassLoader::definePackage ( String  name,
String  specTitle,
String  specVendor,
String  specVersion,
String  implTitle,
String  implVendor,
String  implVersion,
URL  sealed 
) [inline, protected]

Defines a new package and creates a Package object. The package should be defined before any class in the package is defined with defineClass(). The package should not yet be defined before in this classloader or in one of its parents (which means that getPackage() should return null). All parameters except the name of the package may be null.

Subclasses should call this method from their findClass() implementation before calling defineClass() on a Class in a not yet defined Package (which can be checked by calling getPackage()).

name the name of the Package
specTitle the name of the specification
specVendor the name of the specification designer
specVersion the version of this specification
implTitle the name of the implementation
implVendor the vendor that wrote this implementation
implVersion the version of this implementation
sealed if sealed the origin of the package classes
the Package object for the specified package
IllegalArgumentException if the package name is null or it was already defined by this classloader or one of its parents
See also:

Definition at line 754 of file ClassLoader.java.

References definedPackages, and getPackage().

    if (getPackage(name) != null)
      throw new IllegalArgumentException("Package " + name
                                         + " already defined");
    Package p = new Package(name, specTitle, specVendor, specVersion,
                            implTitle, implVendor, implVersion, sealed);
    synchronized (definedPackages)
        definedPackages.put(name, p);
    return p;

Generated by  Doxygen 1.6.0   Back to index