/** * Creates a copy of a method with a new name. This method is provided for creating a new method * based on an existing method. * * @param src the source method. * @param name the name of the created method. * @param declaring the class to which the created method is added. * @param map the hashtable associating original class names with substituted names. It can be * <code>null</code>. * @see CtMethod#CtMethod(CtMethod,CtClass,ClassMap) */ public static CtMethod copy(CtMethod src, String name, CtClass declaring, ClassMap map) throws CannotCompileException { CtMethod cm = new CtMethod(src, declaring, map); cm.setName(name); return cm; }