PageRenderTime 82ms CodeModel.GetById 40ms app.highlight 4ms RepoModel.GetById 37ms app.codeStats 0ms

/jEdit/tags/jedit-4-3-pre5/bsh/ClassGenerator.java

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