20120618, rgf

org.rexxla.bsf.engines.rexx
Class RexxExtendingClassLoader

java.lang.Object
  extended by java.lang.ClassLoader
      extended by org.rexxla.bsf.engines.rexx.RexxExtendingClassLoader

public class RexxExtendingClassLoader
extends java.lang.ClassLoader

Java class which allows extending (abstract and concrete) Java classes on the fly such that the methods in the extended class will forward the method invocation to a RexxProxy; the extended class will be loaded and returned.

------------------------ Apache Version 2.0 license -------------------------
    Copyright (C) 2009 Rony G. Flatscher

    Licensed under the Apache License, Version 2.0 (the "License");
    you may not use this file except in compliance with the License.
    You may obtain a copy of the License at

        http://www.apache.org/licenses/LICENSE-2.0

    Unless required by applicable law or agreed to in writing, software
    distributed under the License is distributed on an "AS IS" BASIS,
    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    See the License for the specific language governing permissions and
    limitations under the License.
 ----------------------------------------------------------------------------- 

Since:
2009-07-29
Version:
1.0
Author:
Rony G. Flatscher (WU Vienna , http://www.wu-wien.ac.at/english)

Field Summary
(package private) static int jvmClassVersion
          Gets and stores the class version of the JVM.
 
Constructor Summary
RexxExtendingClassLoader()
           
 
Method Summary
 java.lang.Class generateAndLoadExtendedClass(java.lang.String clzName)
          Reads the given class and generates a new, extended which forwards all method invocations to a RexxProxy.
 java.lang.Class generateAndLoadExtendedClass(java.lang.String clzName, java.lang.String clzNewName, int classVersion)
          Reads the given class and generates a new, extended which forwards all method invocations to a RexxProxy.
 java.lang.Class generateAndLoadExtendedClass(java.lang.String clzName, java.lang.String clzNewName, int classVersion, java.lang.String[] methodNamesToAdd)
          Reads the given class and generates a new, extended which forwards all method invocations to a RexxProxy.
static void main(java.lang.String[] args)
          Allows to supply the Java class name, the extended (new) name to use and the desired class version of the newly created extended class file.
 
Methods inherited from class java.lang.ClassLoader
clearAssertionStatus, defineClass, defineClass, defineClass, defineClass, definePackage, findClass, findLibrary, findLoadedClass, findResource, findResources, findSystemClass, getPackage, getPackages, getParent, getResource, getResourceAsStream, getResources, getSystemClassLoader, getSystemResource, getSystemResourceAsStream, getSystemResources, loadClass, loadClass, resolveClass, setClassAssertionStatus, setDefaultAssertionStatus, setPackageAssertionStatus, setSigners
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

jvmClassVersion

static final int jvmClassVersion
Gets and stores the class version of the JVM. This determines the default class version of the extended, dynamically created classes.

Constructor Detail

RexxExtendingClassLoader

public RexxExtendingClassLoader()
Method Detail

generateAndLoadExtendedClass

public java.lang.Class generateAndLoadExtendedClass(java.lang.String clzName)
                                             throws java.lang.ClassNotFoundException
Reads the given class and generates a new, extended which forwards all method invocations to a RexxProxy.

Throws:
java.lang.ClassNotFoundException

generateAndLoadExtendedClass

public java.lang.Class generateAndLoadExtendedClass(java.lang.String clzName,
                                                    java.lang.String clzNewName,
                                                    int classVersion)
                                             throws java.lang.ClassNotFoundException
Reads the given class and generates a new, extended which forwards all method invocations to a RexxProxy.

Throws:
java.lang.ClassNotFoundException

generateAndLoadExtendedClass

public java.lang.Class generateAndLoadExtendedClass(java.lang.String clzName,
                                                    java.lang.String clzNewName,
                                                    int classVersion,
                                                    java.lang.String[] methodNamesToAdd)
                                             throws java.lang.ClassNotFoundException
Reads the given class and generates a new, extended which forwards all method invocations to a RexxProxy.

Throws:
java.lang.ClassNotFoundException

main

public static void main(java.lang.String[] args)
                 throws java.lang.Exception
Allows to supply the Java class name, the extended (new) name to use and the desired class version of the newly created extended class file.

Throws:
java.lang.Exception

20120618, rgf