|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectharpoon.Analysis.Transformation.MethodMutator
harpoon.Analysis.Realtime.ClassReplacer
public class ClassReplacer
ClassReplacer
is a MethodMutator
which
works on any QuadForm and replaces NEW's and CALL's to one class with
NEW's and CALL's to another class using a mapping function to map methods
of one to methods of the other. It can also ignore (not update) listed
classes or packages. This class allows you to write a wrapper for a
class for which you don't have the code, and have other code selectively
point to the wrapper.
Currently, only QuadNoSSA and QuadWithTry are supported. This may change
in the future.
Constructor Summary | |
---|---|
ClassReplacer(HCodeFactory parent,
HClass from,
HClass to)
Construct a ClassReplacer with an HCodeFactory
that will replace the HClass from with
to . |
Method Summary | |
---|---|
void |
addIgnoreClasses(HClass claz)
Do not replace references to from in the class
claz . |
void |
addIgnorePackage(String pkg)
Do not replace references to from in the package
pkg . |
void |
map(HMethod from,
HMethod to)
Map a method on the original class to a method on the "to" class. |
void |
mapAll(HClass from,
HClass to)
Map all of the methods from HClass |
protected HCode |
mutateHCode(HCodeAndMaps input)
Make the actual changes to the HCode. |
Methods inherited from class harpoon.Analysis.Transformation.MethodMutator |
---|
cloneHCode, codeFactory, mutateCodeName |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public ClassReplacer(HCodeFactory parent, HClass from, HClass to)
ClassReplacer
with an HCodeFactory
that will replace the HClass
from
with
to
.
Method Detail |
---|
public void addIgnorePackage(String pkg)
from
in the package
pkg
.
public void addIgnoreClasses(HClass claz)
from
in the class
claz
. from
is automatically ignored.
public void map(HMethod from, HMethod to)
public void mapAll(HClass from, HClass to)
HClass from
to to
that share the same name and method signature.
Warning: slow for big classes.
protected HCode mutateHCode(HCodeAndMaps input)
mutateHCode
in class MethodMutator
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |