Você não pode selecionar mais de 25 tópicos Os tópicos devem começar com uma letra ou um número, podem incluir traços ('-') e podem ter até 35 caracteres.

Assistant.java 2.0KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. /*
  2. * Javassist, a Java-bytecode translator toolkit.
  3. * Copyright (C) 1999-2005 Shigeru Chiba. All Rights Reserved.
  4. *
  5. * The contents of this file are subject to the Mozilla Public License Version
  6. * 1.1 (the "License"); you may not use this file except in compliance with
  7. * the License. Alternatively, the contents of this file may be used under
  8. * the terms of the GNU Lesser General Public License Version 2.1 or later.
  9. *
  10. * Software distributed under the License is distributed on an "AS IS" basis,
  11. * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
  12. * for the specific language governing rights and limitations under the
  13. * License.
  14. */
  15. package sample.preproc;
  16. import javassist.CtClass;
  17. import javassist.CannotCompileException;
  18. import javassist.ClassPool;
  19. /**
  20. * This is an interface for objects invoked by the
  21. * Javassist preprocessor when the preprocessor encounters an annotated
  22. * import declaration.
  23. *
  24. * @see sample.preproc.Compiler
  25. */
  26. public interface Assistant {
  27. /**
  28. * Is called when the Javassist preprocessor encounters an
  29. * import declaration annotated with the "by" keyword.
  30. *
  31. * <p>The original import declaration is replaced with new import
  32. * declarations of classes returned by this method. For example,
  33. * the following implementation does not change the original
  34. * declaration:
  35. *
  36. * <ul><pre>
  37. * public CtClass[] assist(ClassPool cp, String importname, String[] args) {
  38. * return new CtClass[] { cp.get(importname) };
  39. * }
  40. * </pre></uL>
  41. *
  42. * @param cp class pool
  43. * @param importname the class imported by the declaration
  44. * @param args the parameters specified by the annotation
  45. * @return the classes imported in the java source
  46. * program produced by the preprocessor.
  47. */
  48. public CtClass[] assist(ClassPool cp, String importname,
  49. String[] args) throws CannotCompileException;
  50. }