File tree 1 file changed +4
-2
lines changed
plugin/src/main/java/com/flit/protoc/gen/server
1 file changed +4
-2
lines changed Original file line number Diff line number Diff line change 3
3
import com .google .protobuf .DescriptorProtos ;
4
4
import com .squareup .javapoet .ClassName ;
5
5
6
+ import java .io .File ;
6
7
import java .util .HashMap ;
7
8
import java .util .List ;
8
9
import java .util .Map ;
@@ -34,7 +35,8 @@ public static String getClassname(DescriptorProtos.FileDescriptorProto proto) {
34
35
35
36
if (clazz == null || clazz .isEmpty ()) {
36
37
37
- char [] classname = proto .getName ().substring (0 , proto .getName ().lastIndexOf ('.' )).toCharArray ();
38
+ String basename = new File (proto .getName ()).getName ();
39
+ char [] classname = basename .substring (0 , basename .lastIndexOf ('.' )).toCharArray ();
38
40
StringBuilder sb = new StringBuilder ();
39
41
40
42
char previous = '_' ;
@@ -70,7 +72,7 @@ public static String getClassname(DescriptorProtos.FileDescriptorProto proto) {
70
72
}
71
73
}
72
74
73
- return clazz ;
75
+ return String . join ( "." , proto . getOptions (). getJavaPackage (), clazz ) ;
74
76
}
75
77
76
78
}
You can’t perform that action at this time.
0 commit comments