/** * Modify a method body so that instantiation of the class * specified by <code>oldClass</code> * is replaced with instantiation of another class <code>newClass</code>. * For example, * <code>replaceNew(ctPoint, ctPoint2)</code> * (where <code>ctPoint</code> and <code>ctPoint2</code> are * compile-time classes for class <code>Point</code> and class * <code>Point2</code>, respectively) * replaces all occurrences of: * * <pre>new Point(x, y)</pre> * * in the method body with: * * <pre>new Point2(x, y)</pre> * * <p>Note that <code>Point2</code> must be type-compatible with <code>Point</code>. * It must have the same set of methods, fields, and constructors as the * replaced class. */ public void replaceNew(CtClass oldClass, CtClass newClass) { transformers = new TransformNewClass(transformers, oldClass.getName(), newClass.getName()); }
/** * Modify a method body so that instantiation of the class * specified by <code>oldClass</code> * is replaced with instantiation of another class <code>newClass</code>. * For example, * <code>replaceNew(ctPoint, ctPoint2)</code> * (where <code>ctPoint</code> and <code>ctPoint2</code> are * compile-time classes for class <code>Point</code> and class * <code>Point2</code>, respectively) * replaces all occurrences of: * * <pre>new Point(x, y)</pre> * * in the method body with: * * <pre>new Point2(x, y)</pre> * * <p>Note that <code>Point2</code> must be type-compatible with <code>Point</code>. * It must have the same set of methods, fields, and constructors as the * replaced class. */ public void replaceNew(CtClass oldClass, CtClass newClass) { transformers = new TransformNewClass(transformers, oldClass.getName(), newClass.getName()); }
/** * Modify a method body so that instantiation of the class * specified by <code>oldClass</code> * is replaced with instantiation of another class <code>newClass</code>. * For example, * <code>replaceNew(ctPoint, ctPoint2)</code> * (where <code>ctPoint</code> and <code>ctPoint2</code> are * compile-time classes for class <code>Point</code> and class * <code>Point2</code>, respectively) * replaces all occurrences of: * * <ul><code>new Point(x, y)</code></ul> * * in the method body with: * * <ul><code>new Point2(x, y)</code></ul> * * <p>Note that <code>Point2</code> must be type-compatible with <code>Point</code>. * It must have the same set of methods, fields, and constructors as the * replaced class. */ public void replaceNew(CtClass oldClass, CtClass newClass) { transformers = new TransformNewClass(transformers, oldClass.getName(), newClass.getName()); }
/** * Modify a method body so that instantiation of the class * specified by <code>oldClass</code> * is replaced with instantiation of another class <code>newClass</code>. * For example, * <code>replaceNew(ctPoint, ctPoint2)</code> * (where <code>ctPoint</code> and <code>ctPoint2</code> are * compile-time classes for class <code>Point</code> and class * <code>Point2</code>, respectively) * replaces all occurrences of: * * <ul><code>new Point(x, y)</code></ul> * * in the method body with: * * <ul><code>new Point2(x, y)</code></ul> * * <p>Note that <code>Point2</code> must be type-compatible with <code>Point</code>. * It must have the same set of methods, fields, and constructors as the * replaced class. */ public void replaceNew(CtClass oldClass, CtClass newClass) { transformers = new TransformNewClass(transformers, oldClass.getName(), newClass.getName()); }
/** * Modify a method body so that instantiation of the class * specified by <code>oldClass</code> * is replaced with instantiation of another class <code>newClass</code>. * For example, * <code>replaceNew(ctPoint, ctPoint2)</code> * (where <code>ctPoint</code> and <code>ctPoint2</code> are * compile-time classes for class <code>Point</code> and class * <code>Point2</code>, respectively) * replaces all occurrences of: * * <ul><code>new Point(x, y)</code></ul> * * in the method body with: * * <ul><code>new Point2(x, y)</code></ul> * * <p>Note that <code>Point2</code> must be type-compatible with <code>Point</code>. * It must have the same set of methods, fields, and constructors as the * replaced class. */ public void replaceNew(CtClass oldClass, CtClass newClass) { transformers = new TransformNewClass(transformers, oldClass.getName(), newClass.getName()); }
/** * Modify a method body so that instantiation of the class * specified by <code>oldClass</code> * is replaced with instantiation of another class <code>newClass</code>. * For example, * <code>replaceNew(ctPoint, ctPoint2)</code> * (where <code>ctPoint</code> and <code>ctPoint2</code> are * compile-time classes for class <code>Point</code> and class * <code>Point2</code>, respectively) * replaces all occurrences of: * * <ul><code>new Point(x, y)</code></ul> * * in the method body with: * * <ul><code>new Point2(x, y)</code></ul> * * <p>Note that <code>Point2</code> must be type-compatible with <code>Point</code>. * It must have the same set of methods, fields, and constructors as the * replaced class. */ public void replaceNew(CtClass oldClass, CtClass newClass) { transformers = new TransformNewClass(transformers, oldClass.getName(), newClass.getName()); }