01: package org.gjt.sp.jedit.bsh;
02:
03: import org.gjt.sp.jedit.bsh.Capabilities.Unavailable;
04: import java.lang.reflect.InvocationTargetException;
05:
06: public abstract class ClassGenerator {
07: private static ClassGenerator cg;
08:
09: public static ClassGenerator getClassGenerator()
10: throws UtilEvalError {
11: if (cg == null) {
12: try {
13: Class clas = Class
14: .forName("org.gjt.sp.jedit.bsh.ClassGeneratorImpl");
15: cg = (ClassGenerator) clas.newInstance();
16: } catch (Exception e) {
17: throw new Unavailable("ClassGenerator unavailable: "
18: + e);
19: }
20: }
21:
22: return cg;
23: }
24:
25: /**
26: Parse the BSHBlock for the class definition and generate the class.
27: */
28: public abstract Class generateClass(String name,
29: Modifiers modifiers, Class[] interfaces, Class super Class,
30: BSHBlock block, boolean isInterface, CallStack callstack,
31: Interpreter interpreter) throws EvalError;
32:
33: /**
34: Invoke a super.method() style superclass method on an object instance.
35: This is not a normal function of the Java reflection API and is
36: provided by generated class accessor methods.
37: */
38: public abstract Object invokeSuperclassMethod(BshClassManager bcm,
39: Object instance, String methodName, Object[] args)
40: throws UtilEvalError, ReflectError,
41: InvocationTargetException;
42:
43: /**
44: Change the parent of the class instance namespace.
45: This is currently used for inner class support.
46: Note: This method will likely be removed in the future.
47: */
48: public abstract void setInstanceNameSpaceParent(Object instance,
49: String className, NameSpace parent);
50:
51: }
|