annoj.loader
Class MainMethodBootstrap

java.lang.Object
  extended by annoj.loader.MainMethodBootstrap

public class MainMethodBootstrap
extends java.lang.Object

Bootstrap class for loading classes with callMainMethod method. Its argument is an array in which the 0th element is the binary name of the class in which the callMainMethod method to call is declared. The other elements are the arguments to that callMainMethod method.
This class loads a class by the TransformingClassLoader so all nodes of the loaded class hierarchy will be loaded by this loader.
A typical usage:

        MainMethodBootstrap.callMainMethod("classloadertest.Main", args);
 
In the example, instead of calling callMainMethod directly in class Main we call it using MainMethodBootstrap that gives us the opportunity to load all classes by TransformingClassLoader. The class loader then processes the annotations in every classes it loads.

Author:
Tajti Ákos

Constructor Summary
Constructor and Description
MainMethodBootstrap()
           
 
Method Summary
Modifier and Type Method and Description
static void callMainMethod(java.lang.String className, java.lang.String[] args)
          Call main method in class className with arguments given in args.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MainMethodBootstrap

public MainMethodBootstrap()
Method Detail

callMainMethod

public static void callMainMethod(java.lang.String className,
                                  java.lang.String[] args)
                           throws java.lang.ClassNotFoundException,
                                  java.lang.NoSuchMethodException,
                                  java.lang.IllegalAccessException,
                                  java.lang.IllegalArgumentException,
                                  java.lang.reflect.InvocationTargetException
Call main method in class className with arguments given in args. The class is loaded by TransformingClassLoader.

Parameters:
className -
args -
Throws:
java.lang.ClassNotFoundException
java.lang.NoSuchMethodException
java.lang.IllegalAccessException
java.lang.IllegalArgumentException
java.lang.reflect.InvocationTargetException