PageRenderTime 47ms CodeModel.GetById 13ms RepoModel.GetById 0ms 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
Possible License(s): BSD-3-Clause, AGPL-1.0, Apache-2.0, LGPL-2.0, LGPL-3.0, GPL-2.0, CC-BY-SA-3.0, LGPL-2.1, GPL-3.0, MPL-2.0-no-copyleft-exception, IPL-1.0
  1. package bsh;
  2. import bsh.Capabilities.Unavailable;
  3. import java.lang.reflect.InvocationTargetException;
  4. public abstract class ClassGenerator
  5. {
  6. private static ClassGenerator cg;
  7. public static ClassGenerator getClassGenerator()
  8. throws UtilEvalError
  9. {
  10. if ( cg == null )
  11. {
  12. try {
  13. Class clas = Class.forName( "bsh.ClassGeneratorImpl" );
  14. cg = (ClassGenerator)clas.newInstance();
  15. } catch ( Exception e ) {
  16. throw new Unavailable("ClassGenerator unavailable: "+e);
  17. }
  18. }
  19. return cg;
  20. }
  21. /**
  22. Parse the BSHBlock for the class definition and generate the class.
  23. */
  24. public abstract Class generateClass(
  25. String name, Modifiers modifiers,
  26. Class [] interfaces, Class superClass, BSHBlock block,
  27. boolean isInterface, CallStack callstack, Interpreter interpreter
  28. )
  29. throws EvalError;
  30. /**
  31. Invoke a super.method() style superclass method on an object instance.
  32. This is not a normal function of the Java reflection API and is
  33. provided by generated class accessor methods.
  34. */
  35. public abstract Object invokeSuperclassMethod(
  36. BshClassManager bcm, Object instance, String methodName, Object [] args
  37. )
  38. throws UtilEvalError, ReflectError, InvocationTargetException;
  39. /**
  40. Change the parent of the class instance namespace.
  41. This is currently used for inner class support.
  42. Note: This method will likely be removed in the future.
  43. */
  44. public abstract void setInstanceNameSpaceParent(
  45. Object instance, String className, NameSpace parent );
  46. }