169e17611504376e4d4603925f8528dfc890fd2c6Luis Sigal/* 269e17611504376e4d4603925f8528dfc890fd2c6Luis Sigal * Javassist, a Java-bytecode translator toolkit. 369e17611504376e4d4603925f8528dfc890fd2c6Luis Sigal * Copyright (C) 1999-2005 Shigeru Chiba. All Rights Reserved. 469e17611504376e4d4603925f8528dfc890fd2c6Luis Sigal * 569e17611504376e4d4603925f8528dfc890fd2c6Luis Sigal * The contents of this file are subject to the Mozilla Public License Version 669e17611504376e4d4603925f8528dfc890fd2c6Luis Sigal * 1.1 (the "License"); you may not use this file except in compliance with 769e17611504376e4d4603925f8528dfc890fd2c6Luis Sigal * the License. Alternatively, the contents of this file may be used under 869e17611504376e4d4603925f8528dfc890fd2c6Luis Sigal * the terms of the GNU Lesser General Public License Version 2.1 or later. 969e17611504376e4d4603925f8528dfc890fd2c6Luis Sigal * 1069e17611504376e4d4603925f8528dfc890fd2c6Luis Sigal * Software distributed under the License is distributed on an "AS IS" basis, 1169e17611504376e4d4603925f8528dfc890fd2c6Luis Sigal * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License 1269e17611504376e4d4603925f8528dfc890fd2c6Luis Sigal * for the specific language governing rights and limitations under the 1369e17611504376e4d4603925f8528dfc890fd2c6Luis Sigal * License. 1469e17611504376e4d4603925f8528dfc890fd2c6Luis Sigal */ 1569e17611504376e4d4603925f8528dfc890fd2c6Luis Sigal 1669e17611504376e4d4603925f8528dfc890fd2c6Luis Sigalpackage sample.preproc; 1769e17611504376e4d4603925f8528dfc890fd2c6Luis Sigal 1869e17611504376e4d4603925f8528dfc890fd2c6Luis Sigalimport javassist.CtClass; 1969e17611504376e4d4603925f8528dfc890fd2c6Luis Sigalimport javassist.CannotCompileException; 2069e17611504376e4d4603925f8528dfc890fd2c6Luis Sigalimport javassist.ClassPool; 2169e17611504376e4d4603925f8528dfc890fd2c6Luis Sigal 2269e17611504376e4d4603925f8528dfc890fd2c6Luis Sigal/** 2369e17611504376e4d4603925f8528dfc890fd2c6Luis Sigal * This is an interface for objects invoked by the 2469e17611504376e4d4603925f8528dfc890fd2c6Luis Sigal * Javassist preprocessor when the preprocessor encounters an annotated 2569e17611504376e4d4603925f8528dfc890fd2c6Luis Sigal * import declaration. 2669e17611504376e4d4603925f8528dfc890fd2c6Luis Sigal * 2769e17611504376e4d4603925f8528dfc890fd2c6Luis Sigal * @see sample.preproc.Compiler 2869e17611504376e4d4603925f8528dfc890fd2c6Luis Sigal */ 2969e17611504376e4d4603925f8528dfc890fd2c6Luis Sigalpublic interface Assistant { 3069e17611504376e4d4603925f8528dfc890fd2c6Luis Sigal /** 3169e17611504376e4d4603925f8528dfc890fd2c6Luis Sigal * Is called when the Javassist preprocessor encounters an 3269e17611504376e4d4603925f8528dfc890fd2c6Luis Sigal * import declaration annotated with the "by" keyword. 3369e17611504376e4d4603925f8528dfc890fd2c6Luis Sigal * 3469e17611504376e4d4603925f8528dfc890fd2c6Luis Sigal * <p>The original import declaration is replaced with new import 3569e17611504376e4d4603925f8528dfc890fd2c6Luis Sigal * declarations of classes returned by this method. For example, 3669e17611504376e4d4603925f8528dfc890fd2c6Luis Sigal * the following implementation does not change the original 3769e17611504376e4d4603925f8528dfc890fd2c6Luis Sigal * declaration: 3869e17611504376e4d4603925f8528dfc890fd2c6Luis Sigal * 3969e17611504376e4d4603925f8528dfc890fd2c6Luis Sigal * <ul><pre> 4069e17611504376e4d4603925f8528dfc890fd2c6Luis Sigal * public CtClass[] assist(ClassPool cp, String importname, String[] args) { 4169e17611504376e4d4603925f8528dfc890fd2c6Luis Sigal * return new CtClass[] { cp.get(importname) }; 4269e17611504376e4d4603925f8528dfc890fd2c6Luis Sigal * } 4369e17611504376e4d4603925f8528dfc890fd2c6Luis Sigal * </pre></uL> 4469e17611504376e4d4603925f8528dfc890fd2c6Luis Sigal * 4569e17611504376e4d4603925f8528dfc890fd2c6Luis Sigal * @param cp class pool 4669e17611504376e4d4603925f8528dfc890fd2c6Luis Sigal * @param importname the class imported by the declaration 4769e17611504376e4d4603925f8528dfc890fd2c6Luis Sigal * @param args the parameters specified by the annotation 4869e17611504376e4d4603925f8528dfc890fd2c6Luis Sigal * @return the classes imported in the java source 4969e17611504376e4d4603925f8528dfc890fd2c6Luis Sigal * program produced by the preprocessor. 5069e17611504376e4d4603925f8528dfc890fd2c6Luis Sigal */ 5169e17611504376e4d4603925f8528dfc890fd2c6Luis Sigal public CtClass[] assist(ClassPool cp, String importname, 5269e17611504376e4d4603925f8528dfc890fd2c6Luis Sigal String[] args) throws CannotCompileException; 5369e17611504376e4d4603925f8528dfc890fd2c6Luis Sigal} 54