noope.input
Class BRClassLoaderUtils

java.lang.Object
  |
  +--noope.input.BRClassLoaderUtils

public class BRClassLoaderUtils
extends java.lang.Object

This class provides utility functions for dynamically loading classes from BlockReader objects. It is used by Laws, Entities and OutputProjection. All methods are static, you should not construct instances of this class.

Version:
12-Apr-2001 Changed by Miklos Reiter so the methods take BlockReaderLocation objects instead of BlockReaders, because this is all they need and to provide more flexibility.
Author:
Originally written by Miklos Reiter as methods of OutputProjection, relocated by James Kermode.

Constructor Summary
BRClassLoaderUtils()
           
 
Method Summary
static void assertSubClass(BlockReaderLocation brL, java.lang.Class parent, java.lang.Class child)
          This method asserts that the Class child is a subclass of the Class parent If it isn't, a BRLoadingException is thrown.
static java.lang.Class getClassWithExactName(BlockReaderLocation brL, java.lang.String className)
          Gets the class with the given name.
static java.lang.Class getClassWithName(BlockReaderLocation brL, java.lang.String className, java.lang.String defaultPackage)
          Tries to get the class with the given name.
static java.lang.reflect.Constructor getConstructor(BlockReaderLocation brL, java.lang.Class theClass, java.lang.Class[] paramsClasses)
          Gets the constructor of theClass matching the parameter format paramsClasses.
static java.lang.Object getNewInstance(BlockReaderLocation brL, java.lang.Class theClass, java.lang.reflect.Constructor theConstructor, java.lang.Object[] params)
          Creates a new instance constructed with theConstructor, with params as the arguments.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

BRClassLoaderUtils

public BRClassLoaderUtils()
Method Detail

getClassWithExactName

public static java.lang.Class getClassWithExactName(BlockReaderLocation brL,
                                                    java.lang.String className)
                                             throws BRLoadingException
Gets the class with the given name. br is needed to get the EntryLocation() if something fails.

getClassWithName

public static java.lang.Class getClassWithName(BlockReaderLocation brL,
                                               java.lang.String className,
                                               java.lang.String defaultPackage)
                                        throws BRLoadingException
Tries to get the class with the given name. It tries the given name and the given name prefixed with defaultPackage. If something fails, an appropriate BRLoadingException occurrs.

assertSubClass

public static void assertSubClass(BlockReaderLocation brL,
                                  java.lang.Class parent,
                                  java.lang.Class child)
                           throws BRLoadingException
This method asserts that the Class child is a subclass of the Class parent If it isn't, a BRLoadingException is thrown.

getConstructor

public static java.lang.reflect.Constructor getConstructor(BlockReaderLocation brL,
                                                           java.lang.Class theClass,
                                                           java.lang.Class[] paramsClasses)
                                                    throws BRLoadingException
Gets the constructor of theClass matching the parameter format paramsClasses.

getNewInstance

public static java.lang.Object getNewInstance(BlockReaderLocation brL,
                                              java.lang.Class theClass,
                                              java.lang.reflect.Constructor theConstructor,
                                              java.lang.Object[] params)
                                       throws BRLoadingException
Creates a new instance constructed with theConstructor, with params as the arguments.