Easy way to stack up a couple of ASM-Bytecode visitors?

You already stacking up two visitors - ClassWriter and MethodRenamerVisitor. Basically the next visitor in the chain is passed as first parameter I constructor. So the third one can be added like this.

You already stacking up two visitors - ClassWriter and MethodRenamerVisitor. Basically the next visitor in the chain is passed as first parameter I constructor. So the third one can be added like this: ThirdVisitor v3 = new ThirdVisitor(methodRenamerVisitor); ForthVisitor v4 = new ForthVisitor(v3); etc.

That way they are terrible coupled. I can't, for instance, at run-time to choose which visitors I'd like to run. – devoured elysium Oct 31 at 16:14 There is no coupling.

The constructor takes a ClassVisitor instance. If you really want to shuffle them at runtime, you can create collection of factories, each factory would take instance of "previous visitor" and create instance of specific visitor for that factory. Pretty simple.

Though in my experience I haven't seen use case when something like that would be necessary. – Eugene Kuleshov Nov 1 at 23:11 Awkward, at best. But as there seems to be no other alternative.. – devoured elysium Nov 2 at 9:05 Think about visitor chain as a "pipe" operator ("|") in shell scripts.

Output of previous command can be redirected to the next command. – Eugene Kuleshov Nov 3 at 19:55.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions