Java - 对协议缓冲区生成的文件进行逆向工程

问题描述 投票:0回答:1

我是 Springboot 新手。最近加入了一个springboot项目,看到了一个java文件

package org.thingsboard.server.controller.tts;// Generated by the protocol buffer compiler.  DO NOT EDIT!
// source: my_attributes.proto

// Protobuf Java Version: 3.25.1
public final class MyAttributesOuterClass {
  private MyAttributesOuterClass() {}
  public static void registerAllExtensions(
      com.google.protobuf.ExtensionRegistryLite registry) {
  }

  public static void registerAllExtensions(
      com.google.protobuf.ExtensionRegistry registry) {
    registerAllExtensions(
        (com.google.protobuf.ExtensionRegistryLite) registry);
  }
  /**
   * <pre>
   * Enum of device types
   * </pre>
   *
   * Protobuf enum {@code DeviceType}
   */

…

我想做的是,为此类添加一个新字段,但我不知道如何以正确的方式做到这一点。

我尝试搜索my_attributes.proto,但项目中不存在。

有protobuf的依赖

        <dependency>
            <groupId>com.google.protobuf</groupId>
            <artifactId>protobuf-java</artifactId>
        </dependency>
        ...
        <plugin>
           <groupId>org.xolstice.maven.plugins</groupId>
           <artifactId>protobuf-maven-plugin</artifactId>
        </plugin>

所以我想知道是否有人有办法找到这个文件的来源,以及这个文件最初是如何生成的,或者如何逆向工程这个文件等

java spring-boot protocol-buffers
1个回答
0
投票

默认情况下

proto
文件位于
src/main/proto/

© www.soinside.com 2019 - 2024. All rights reserved.