org.codehaus.classworlds
Class ClassWorld

java.lang.Object
  extended byorg.codehaus.classworlds.ClassWorld

public class ClassWorld
extends java.lang.Object

A collection of ClassRealms, indexed by id.

Version:
$Id: ClassWorld.java,v 1.2 2003/09/23 14:09:46 jvanzyl Exp $
Author:
bob mcwhirter

Field Summary
private  java.util.Map realms
          Realms, indexed by id.
 
Constructor Summary
ClassWorld()
          Construct.
 
Method Summary
 ClassRealm getRealm(java.lang.String id)
          Retrieve a ClassRealm by its id.
(package private)  DefaultClassRealm getRealmImpl(java.lang.String id)
          Retrieve a ClassRealmImpl by its id.
 java.util.Collection getRealms()
          Retrieve the collection of all ClassRealms in this world.
(package private)  java.lang.Class loadClass(java.lang.String name)
          Load a class.
 ClassRealm newRealm(java.lang.String id)
          Create a new ClassRealm.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

realms

private java.util.Map realms
Realms, indexed by id.

Constructor Detail

ClassWorld

public ClassWorld()
Construct.

Method Detail

newRealm

public ClassRealm newRealm(java.lang.String id)
                    throws DuplicateRealmException
Create a new ClassRealm.

Parameters:
id - The realm id.
Returns:
The newly created realm.
Throws:
DuplicateRealmException - If this class-world already contains a realm with the specified id.

getRealm

public ClassRealm getRealm(java.lang.String id)
                    throws NoSuchRealmException
Retrieve a ClassRealm by its id.

Parameters:
id - The id.
Returns:
The matching class-realm.
Throws:
NoSuchRealmException - If the id does not correspond to any known class-realm.

getRealmImpl

DefaultClassRealm getRealmImpl(java.lang.String id)
                         throws NoSuchRealmException
Retrieve a ClassRealmImpl by its id.

Parameters:
id - The id.
Returns:
The matching class-realm.
Throws:
NoSuchRealmException - If the id does not correspond to any known class-realm.

getRealms

public java.util.Collection getRealms()
Retrieve the collection of all ClassRealms in this world.

Returns:
The collectio of class-realms.

loadClass

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.