com.google.protobuf.DescriptorProtos.FileOptions源码实例Demo

类com.google.protobuf.DescriptorProtos.FileOptions源码实例Demo

下面列出了com.google.protobuf.DescriptorProtos.FileOptions 类实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。

源代码1 项目: servicetalk   文件: FileDescriptor.java
FileDescriptor(final FileDescriptorProto protoFile) {
    this.protoFile = protoFile;
    sanitizedProtoFileName = sanitizeFileName(protoFile.getName());
    protoPackageName = protoFile.hasPackage() ? protoFile.getPackage() : null;

    if (protoFile.hasOptions()) {
        final FileOptions fileOptions = protoFile.getOptions();
        deprecated = fileOptions.hasDeprecated() && fileOptions.getDeprecated();
        multipleClassFiles = fileOptions.hasJavaMultipleFiles() && fileOptions.getJavaMultipleFiles();
        javaPackageName = fileOptions.hasJavaPackage() ? fileOptions.getJavaPackage() : null;
        outerClassName = fileOptions.hasJavaOuterClassname() ? fileOptions.getJavaOuterClassname() : null;
    } else {
        deprecated = false;
        multipleClassFiles = false;
        javaPackageName = null;
        outerClassName = null;
    }

    serviceClassBuilders = new ArrayList<>(protoFile.getServiceCount());
}
 
源代码2 项目: saluki   文件: CommonProto2Java.java
private Pair<String, String> packageClassName(FileOptions options) {
  String packageName = null;
  String className = null;
  for (Map.Entry<FieldDescriptor, Object> entry : options.getAllFields().entrySet()) {
    if (entry.getKey().getName().equals("java_package")) {
      packageName = entry.getValue().toString();
    }
    if (entry.getKey().getName().equals("java_outer_classname")) {
      className = entry.getValue().toString();
    }
  }
  if (packageName != null && className != null) {
    return new ImmutablePair<String, String>(packageName, className);
  }
  return null;
}
 
源代码3 项目: sofa-rpc   文件: AbstractGenerator.java
/**
 * fetch the package name
 *
 * @param proto
 * @return
 */
private String extractPackageName(FileDescriptorProto proto) {
    FileOptions options = proto.getOptions();
    if (options != null) {
        String javaPackage = options.getJavaPackage();
        if (!Strings.isNullOrEmpty(javaPackage)) {
            return javaPackage;
        }
    }

    return Strings.nullToEmpty(proto.getPackage());
}
 
源代码4 项目: reactive-grpc   文件: ReactiveGrpcGenerator.java
private String extractPackageName(FileDescriptorProto proto) {
    FileOptions options = proto.getOptions();
    if (options != null) {
        String javaPackage = options.getJavaPackage();
        if (!Strings.isNullOrEmpty(javaPackage)) {
            return javaPackage;
        }
    }

    return Strings.nullToEmpty(proto.getPackage());
}
 
源代码5 项目: fuchsia   文件: ProtoGenerator.java
public void generateProtoFromDescriptor(FileDescriptor descriptor,
                                        Appendable out, Descriptor wrapperMessage) throws IOException {
    String package1 = descriptor.getPackage();
    if (package1 != null) {
        out.append("package " + package1 + ";\n");
    }

    FileOptions options = descriptor.getOptions();
    String javaPackage = options.getJavaPackage();
    if (javaPackage != null) {
        out.append("option java_package = \"" + javaPackage + "\";\n");
    }

    String javaOuterClassname = options.getJavaOuterClassname();
    if (javaOuterClassname != null) {
        out.append("option java_outer_classname = \"" + javaOuterClassname
                + "\";\n");
    }

    for (ServiceDescriptor serviceDescriptor : descriptor.getServices()) {
        generateProtoFromDescriptor(serviceDescriptor, out);
    }

    for (Descriptor messageDescriptor : descriptor.getMessageTypes()) {
        if (wrapperMessage != null && messageDescriptor.equals(wrapperMessage)) {
            out.append("// This is the message you can send to this service (wrapper message):\n");
        }

        generateProtoFromDescriptor(messageDescriptor, out, "",
                new LinkedHashMap<Descriptor, Boolean>());
    }

    for (EnumDescriptor enumDescriptor : descriptor.getEnumTypes()) {
        generateProtoFromDescriptor(enumDescriptor, out, "");
    }
}
 
源代码6 项目: play-store-api   文件: Descriptors.java
/** Get the {@code FileOptions}, defined in {@code descriptor.proto}. */
public FileOptions getOptions() { return proto.getOptions(); }
 
源代码评论
动弹
沙发等你来抢
 类所在包
 类方法
 同包方法