Class SourceCodeInfoParser

java.lang.Object
com.google.api.generator.gapic.protoparser.SourceCodeInfoParser

public class SourceCodeInfoParser extends Object
A helper class which provides protocol buffer source info for descriptors.

In order to make this work, the descriptors need to be produced using the flag --include_source_info. Note that descriptors taken from the generated java code have source info stripped, and won't work with this class.

This class uses internal caches to speed up access to the source info. It is not thread safe. If you think you need this functionality in a thread-safe context, feel free to suggest a refactor.

  • Constructor Details

    • SourceCodeInfoParser

      public SourceCodeInfoParser()
  • Method Details

    • getLocation

      @Nullable public SourceCodeInfoLocation getLocation(com.google.protobuf.Descriptors.Descriptor message)
      Gets the location of a message, if available.
    • getLocation

      @Nullable public SourceCodeInfoLocation getLocation(com.google.protobuf.Descriptors.FieldDescriptor field)
      Gets the location of a field, if available.
    • getLocation

      @Nullable public SourceCodeInfoLocation getLocation(com.google.protobuf.Descriptors.ServiceDescriptor service)
      Gets the location of a service, if available.
    • getLocation

      @Nullable public SourceCodeInfoLocation getLocation(com.google.protobuf.Descriptors.MethodDescriptor method)
      Gets the location of a method, if available.
    • getLocation

      @Nullable public SourceCodeInfoLocation getLocation(com.google.protobuf.Descriptors.EnumDescriptor enumType)
      Gets the location of an enum type, if available.
    • getLocation

      @Nullable public SourceCodeInfoLocation getLocation(com.google.protobuf.Descriptors.EnumValueDescriptor enumValue)
      Gets the location of an enum value, if available.
    • getLocation

      @Nullable public SourceCodeInfoLocation getLocation(com.google.protobuf.Descriptors.OneofDescriptor oneof)
      Gets the location of a oneof, if available.