You may also need to provide an ExtensionRegistry as described here <https://developers.google.com/protocol-buffers/docs/reference/java-generated#extension> when you parse the proto, in order for the extension to be visible.
On Fri, Sep 1, 2017 at 3:55 PM, Noel Yap <[email protected]> wrote: > One piece of possibly important information. The code being written is for > a `protoc` plugin. I've updated the Stackoverflow question to state that. > > On Fri, Sep 1, 2017 at 3:42 PM Noel Yap <[email protected]> wrote: > >> proto.getDescriptor().getFile().getOptions() didn't work. If I print >> that out, I see: >> >> java_package: \"com.google.protobuf\"\njava_outer_classname: >> \"DescriptorProtos\"\noptimize_for: SPEED\ngo_package: \" >> github.com/golang/protobuf/protoc-gen-go/descriptor;descriptor\ >> <http://github.com/golang/protobuf/protoc-gen-go/descriptor;descriptor%5C> >> "\nobjc_class_prefix: \"GPB\"\ncsharp_namespace: >> \"Google.Protobuf.Reflection\" >> >> I've also tried `proto.getOptions()`. That shows the options like >> `java_package` but `hasExtension` for the extension I'm setting is still >> returning `false`. >> >> On Fri, Sep 1, 2017 at 2:53 PM Adam Cozzette <[email protected]> >> wrote: >> >>> I posted an answer on your StackOverflow post but let me know if you >>> still have any trouble with that. >>> >>> On Wed, Aug 30, 2017 at 4:13 PM, Noel Yap <[email protected]> wrote: >>> >>>> https://stackoverflow.com/questions/45970986/how-to-get- >>>> value-of-protobuf-custom-option-in-java >>>> >>> -- >>>> You received this message because you are subscribed to the Google >>>> Groups "Protocol Buffers" group. >>>> To unsubscribe from this group and stop receiving emails from it, send >>>> an email to [email protected]. >>> >>> >>>> To post to this group, send email to [email protected]. >>>> Visit this group at https://groups.google.com/group/protobuf. >>>> For more options, visit https://groups.google.com/d/optout. >>>> >>> -- You received this message because you are subscribed to the Google Groups "Protocol Buffers" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at https://groups.google.com/group/protobuf. For more options, visit https://groups.google.com/d/optout.
