ClassRealm (classworlds 1.0-rc1 API)
Keywords: com.werken.classworlds.ClassRealm,ClassRealm interface

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## com.werken.classworlds
Interface ClassRealm

public interface ClassRealm

Autonomous sub-portion of a `ClassWorld`.

This class most closed maps to the `ClassLoader` role from Java and in facts can provide a `ClassLoader` view of itself using `getClassLoader()`.

Version:
  $Id: ClassRealm.java,v 1.7 2003/03/03 07:29:28 jvanzyl Exp $
Author:
  bob mcwhirter, Jason van Zyl

Method Summary
`void` | `addConstituent(java.net.URL constituent)` Add a constituent to this realm for locating classes.
`ClassRealm` | `createChildRealm(java.lang.String id)` Create a child realm.
`java.lang.ClassLoader` | `getClassLoader()` Retrieve the `ClassLoader` that models this `ClassRealm`.
`java.lang.String` | `getId()` Retrieve the id.
`java.net.URL` | `getResource(java.lang.String name)`
`ClassWorld` | `getWorld()` Retrieve the `ClassWorld` of which this is a member.
`void` | `importFrom(java.lang.String realmId, java.lang.String pkgName)` Import packages from another `ClassRealm`.
`java.lang.Class` | `loadClass(java.lang.String name)` Load a class.
`void` | `setParent(ClassRealm classRealm)` Set the parent `ClassRealm`.

Method Detail

### getId

    public java.lang.String getId()

  Retrieve the id.

  Returns:
    The id.

### getWorld

    public ClassWorld getWorld()

  Retrieve the `ClassWorld` of which this is a member.

  Returns:
    The class-world.

### importFrom

    public void importFrom(java.lang.String realmId,
                           java.lang.String pkgName)
                    throws NoSuchRealmException

  Import packages from another `ClassRealm`.

  Specific packages can be imported from another realm instead of attempting to load them locally from this one. When importing a package a realm defers completely to the foreign realm to satisfy the package dependencies.

  Parameters:
    `realmId` - The realm id from which to import.
    `pkgName` - The package name to import.
  Throws:
    `NoSuchRealmException` - If the id of the realm from which to import does not correspond to a foreign realm within this realm's world.

### getClassLoader

    public java.lang.ClassLoader getClassLoader()

  Retrieve the `ClassLoader` that models this `ClassRealm`.

  Returns:
    The classloader.

### loadClass

    public java.lang.Class loadClass(java.lang.String name)
                              throws java.lang.ClassNotFoundException

  Load a class.

  Parameters:
    `name` - The name of the class to load.
  Returns:
    The loaded class.
  Throws:
    `java.lang.ClassNotFoundException` - If the class cannot be found.

### getResource

    public java.net.URL getResource(java.lang.String name)

### addConstituent

    public void addConstituent(java.net.URL constituent)

  Add a constituent to this realm for locating classes.

  A constituent is a URL that points to either a JAR format file containing classes and/or resources, or a directory that should be used for searching. If the constituent is a directory, then the URL must end with a slash (`/`). Otherwise the constituent will be treated as a JAR file.

  Parameters:
    `constituent` - URL to contituent jar or directory.

### setParent

    public void setParent(ClassRealm classRealm)

  Set the parent `ClassRealm`.

  Parameters:
    `classRealm` - The parent ClassRealm.

### createChildRealm

    public ClassRealm createChildRealm(java.lang.String id)

  Create a child realm.

  Parameters:
    `id` - The name of child realm.

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2002-2003 The Werken Company. All Rights Reserved.