@@ -27,6 +27,23 @@ public class ValveGenerator {
2727 public static final String TONGWEB7_VALVE_PACKAGE = "com.tongweb.catalina" ;
2828 public static final String TONGWEB8_VALVE_PACKAGE = "com.tongweb.server" ;
2929
30+ public static DynamicType .Builder <?> build (DynamicType .Builder <?> builder , AbstractShell shell ) {
31+ String packageName = null ;
32+ if (shell instanceof TongWeb6Shell ) {
33+ packageName = TONGWEB6_VALVE_PACKAGE ;
34+ } else if (shell instanceof TongWeb7Shell ) {
35+ packageName = TONGWEB7_VALVE_PACKAGE ;
36+ } else if (shell instanceof TongWeb8Shell ) {
37+ packageName = TONGWEB8_VALVE_PACKAGE ;
38+ } else if (shell instanceof BesShell ) {
39+ packageName = BES_VALVE_PACKAGE ;
40+ }
41+ if (StringUtils .isEmpty (packageName )) {
42+ return builder ;
43+ }
44+ return builder .visit (new ValveRenameVisitorWrapper (packageName ));
45+ }
46+
3047 public static class ValveRenameVisitorWrapper implements AsmVisitorWrapper {
3148 private final String newPackageName ;
3249
@@ -69,21 +86,4 @@ public String map(String typeName) {
6986 });
7087 }
7188 }
72-
73- public static DynamicType .Builder <?> build (DynamicType .Builder <?> builder , AbstractShell shell ) {
74- String packageName = null ;
75- if (shell instanceof TongWeb6Shell ) {
76- packageName = TONGWEB6_VALVE_PACKAGE ;
77- } else if (shell instanceof TongWeb7Shell ) {
78- packageName = TONGWEB7_VALVE_PACKAGE ;
79- } else if (shell instanceof TongWeb8Shell ) {
80- packageName = TONGWEB8_VALVE_PACKAGE ;
81- } else if (shell instanceof BesShell ) {
82- packageName = BES_VALVE_PACKAGE ;
83- }
84- if (StringUtils .isEmpty (packageName )) {
85- return builder ;
86- }
87- return builder .visit (new ValveRenameVisitorWrapper (packageName ));
88- }
8989}
0 commit comments