grpc-java-contrib icon indicating copy to clipboard operation
grpc-java-contrib copied to clipboard

Expose getJavaOuterClassname in JProtoc

Open Fadelis opened this issue 2 years ago • 0 comments

When extending base generated java classes you need to provide the file path to the actual .java file and determining it involves a bit of logic that you've already implemented. So to make it easier to develop protoc extension plugins I'd suggest to expose this method: https://github.com/salesforce/grpc-java-contrib/blob/79aeea46a61b9f3d724a172ab29374931c02fa7c/jprotoc/jprotoc/src/main/java/com/salesforce/jprotoc/ProtoTypeMap.java#L105

Current workaround I've implemented is to extract the filename from the JavaType provided in this map: https://github.com/Fadelis/protoc-gen-java-optional/blob/055440fe6ca14dfeb8ba96413880dd3f45e82fd8/protoc-gen-java-optional/src/main/java/org/grpcmock/protoc/plugin/OptionalGenerator.java#L210-L215

Fadelis avatar Sep 03 '21 07:09 Fadelis