akka.grpc.gen.javadsl.JavaInterfaceCodeGenerator.scala Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of akka-grpc-codegen_2.13 Show documentation
Show all versions of akka-grpc-codegen_2.13 Show documentation
Akka gRPC - Support for building streaming gRPC servers and clients on top of Akka Streams.
The newest version!
/*
* Copyright (C) 2018-2023 Lightbend Inc.
*/
package akka.grpc.gen.javadsl
import scala.collection.immutable
import akka.grpc.gen.Logger
import com.google.protobuf.compiler.PluginProtos.CodeGeneratorResponse
import templates.JavaCommon.txt.ApiInterface
object JavaInterfaceCodeGenerator extends JavaCodeGenerator {
override def name = "akka-grpc-javadsl-interface"
override def perServiceContent: Set[(Logger, Service) => immutable.Seq[CodeGeneratorResponse.File]] =
super.perServiceContent + generateServiceFile
val generateServiceFile: (Logger, Service) => immutable.Seq[CodeGeneratorResponse.File] = (logger, service) => {
val b = CodeGeneratorResponse.File.newBuilder()
b.setContent(ApiInterface(service).body)
b.setName(s"${service.packageDir}/${service.name}.java")
logger.info(s"Generating Akka gRPC service interface for [${service.packageName}.${service.name}]")
immutable.Seq(b.build)
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy