1
2
3
4
5
6
7
8
9 package it.imolinfo.jbi4corba.webservice.generator.bcm;
10
11 import it.imolinfo.jbi4corba.Logger;
12 import it.imolinfo.jbi4corba.LoggerFactory;
13 import it.imolinfo.jbi4corba.webservice.generator.InterfaceType;
14 import it.imolinfo.jbi4corba.webservice.generator.TypeUtils;
15
16 import java.util.Map;
17
18 import org.objectweb.asm.MethodVisitor;
19 import org.objectweb.asm.Opcodes;
20 import org.objectweb.asm.Type;
21 import org.objectweb.asm.util.TraceMethodVisitor;
22
23
24
25
26
27
28 public class ConstructorModMethodVisitor extends TraceMethodVisitor {
29
30
31
32
33 private static final Logger LOG
34 = LoggerFactory.getLogger(ConstructorModMethodVisitor.class);
35
36
37
38
39
40 private String className = null;
41
42
43 private ByteCodeManipulationUtil bcmUtil = new ByteCodeManipulationUtil();
44
45 private Map<String, InterfaceType> allIntTypes;
46
47
48
49
50
51
52
53
54
55 public ConstructorModMethodVisitor(MethodVisitor mv,
56 String className, Map<String, InterfaceType> allInterfaceTypes) {
57 super(mv);
58
59
60 this.className = className;
61 allIntTypes=allInterfaceTypes;
62 }
63
64
65
66
67
68
69
70 @Override
71 public void visitFieldInsn(int opcode,String className,String fieldName,String fieldType){
72
73 LOG.debug("<<<<< AppenderMethodVisitor.visitInsn - end");
74 if(opcode==Opcodes.PUTFIELD){
75 boolean isArray=TypeUtils.isArray(fieldType);
76 if(TypeUtils.isSearchedType(fieldType, isArray, allIntTypes, TypeUtils.INTERFACE)!=null){
77 if (isArray){
78 fieldType= Type.getDescriptor(javax.xml.ws.wsaddressing.W3CEndpointReference[].class);
79
80 }else{
81
82 fieldType= Type.getDescriptor(javax.xml.ws.wsaddressing.W3CEndpointReference.class);
83
84 }
85 }
86 super.visitFieldInsn(opcode,className,fieldName,fieldType);
87
88 }
89
90 }
91
92
93
94
95
96
97
98 }