Classes in this File | Line Coverage | Branch Coverage | Complexity | ||||
DroolsAddGeneratedGetMethodVisitor |
|
| 1.0;1 |
1 | /* | |
2 | Drools5 Integration Helper | |
3 | Copyright (C) 2009 Mathieu Boretti mathieu.boretti@gmail.com | |
4 | ||
5 | This program is free software: you can redistribute it and/or modify | |
6 | it under the terms of the GNU General Public License as published by | |
7 | the Free Software Foundation, either version 3 of the License, or | |
8 | (at your option) any later version. | |
9 | ||
10 | This program is distributed in the hope that it will be useful, | |
11 | but WITHOUT ANY WARRANTY; without even the implied warranty of | |
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
13 | GNU General Public License for more details. | |
14 | ||
15 | You should have received a copy of the GNU General Public License | |
16 | along with this program. If not, see <http://www.gnu.org/licenses/>. | |
17 | ||
18 | */ | |
19 | package org.boretti.drools.integration.drools5; | |
20 | ||
21 | import org.objectweb.asm.MethodVisitor; | |
22 | import org.objectweb.asm.Opcodes; | |
23 | import org.objectweb.asm.Type; | |
24 | import org.objectweb.asm.commons.AdviceAdapter; | |
25 | ||
26 | /** | |
27 | * @author mbo | |
28 | * @since 1.0.0 | |
29 | */ | |
30 | class DroolsAddGeneratedGetMethodVisitor extends AdviceAdapter { | |
31 | ||
32 | private String parent; | |
33 | ||
34 | private String droolsName; | |
35 | ||
36 | private String droolsRule; | |
37 | ||
38 | private String droolsRun; | |
39 | ||
40 | public DroolsAddGeneratedGetMethodVisitor(MethodVisitor mv, | |
41 | int access, | |
42 | String name, | |
43 | String desc, | |
44 | String parent, | |
45 | String droolsName, | |
46 | String droolsRule, | |
47 | String droolsRun) { | |
48 | 0 | super(mv, access, name, desc); |
49 | 0 | this.parent=parent; |
50 | 0 | this.droolsName=droolsName; |
51 | 0 | this.droolsRule=droolsRule; |
52 | 0 | this.droolsRun=droolsRun; |
53 | 0 | } |
54 | ||
55 | /* (non-Javadoc) | |
56 | * @see org.objectweb.asm.commons.AdviceAdapter#onMethodEnter() | |
57 | */ | |
58 | @Override | |
59 | protected void onMethodEnter() { | |
60 | 0 | this.visitVarInsn(Opcodes.ALOAD, 0); |
61 | 0 | this.visitMethodInsn(Opcodes.INVOKEVIRTUAL,Type.getObjectType(parent).getInternalName(),droolsRun, "()V"); |
62 | 0 | } |
63 | ||
64 | /* (non-Javadoc) | |
65 | * @see org.objectweb.asm.commons.LocalVariablesSorter#visitMaxs(int, int) | |
66 | */ | |
67 | @Override | |
68 | public void visitMaxs(int arg0, int arg1) { | |
69 | // TODO Auto-generated method stub | |
70 | 0 | super.visitMaxs(arg0+1, arg1); |
71 | 0 | } |
72 | ||
73 | } |