Search in sources :

Example 1 with GeneratorException

use of com.salesforce.jprotoc.GeneratorException in project dubbo by alibaba.

the class AbstractGenerator method generateFiles.

@Override
public List<PluginProtos.CodeGeneratorResponse.File> generateFiles(PluginProtos.CodeGeneratorRequest request) throws GeneratorException {
    final ProtoTypeMap typeMap = ProtoTypeMap.of(request.getProtoFileList());
    List<FileDescriptorProto> protosToGenerate = request.getProtoFileList().stream().filter(protoFile -> request.getFileToGenerateList().contains(protoFile.getName())).collect(Collectors.toList());
    List<ServiceContext> services = findServices(protosToGenerate, typeMap);
    return generateFiles(services);
}
Also used : Arrays(java.util.Arrays) ServiceDescriptorProto(com.google.protobuf.DescriptorProtos.ServiceDescriptorProto) Set(java.util.Set) HtmlEscapers(com.google.common.html.HtmlEscapers) Generator(com.salesforce.jprotoc.Generator) Collectors(java.util.stream.Collectors) Location(com.google.protobuf.DescriptorProtos.SourceCodeInfo.Location) PluginProtos(com.google.protobuf.compiler.PluginProtos) ProtoTypeMap(com.salesforce.jprotoc.ProtoTypeMap) ArrayList(java.util.ArrayList) HashSet(java.util.HashSet) Strings(com.google.common.base.Strings) List(java.util.List) GeneratorException(com.salesforce.jprotoc.GeneratorException) FileDescriptorProto(com.google.protobuf.DescriptorProtos.FileDescriptorProto) MethodDescriptorProto(com.google.protobuf.DescriptorProtos.MethodDescriptorProto) FileOptions(com.google.protobuf.DescriptorProtos.FileOptions) ProtoTypeMap(com.salesforce.jprotoc.ProtoTypeMap) FileDescriptorProto(com.google.protobuf.DescriptorProtos.FileDescriptorProto)

Aggregations

Strings (com.google.common.base.Strings)1 HtmlEscapers (com.google.common.html.HtmlEscapers)1 FileDescriptorProto (com.google.protobuf.DescriptorProtos.FileDescriptorProto)1 FileOptions (com.google.protobuf.DescriptorProtos.FileOptions)1 MethodDescriptorProto (com.google.protobuf.DescriptorProtos.MethodDescriptorProto)1 ServiceDescriptorProto (com.google.protobuf.DescriptorProtos.ServiceDescriptorProto)1 Location (com.google.protobuf.DescriptorProtos.SourceCodeInfo.Location)1 PluginProtos (com.google.protobuf.compiler.PluginProtos)1 Generator (com.salesforce.jprotoc.Generator)1 GeneratorException (com.salesforce.jprotoc.GeneratorException)1 ProtoTypeMap (com.salesforce.jprotoc.ProtoTypeMap)1 ArrayList (java.util.ArrayList)1 Arrays (java.util.Arrays)1 HashSet (java.util.HashSet)1 List (java.util.List)1 Set (java.util.Set)1 Collectors (java.util.stream.Collectors)1