All Downloads are FREE. Search and download functionalities are using the official Maven repository.

scalapb.compiler.ConstructorField.scala Maven / Gradle / Ivy

The newest version!
package scalapb.compiler

case class ConstructorField(
    name: String,
    typeName: String,
    default: Option[String],
    index: Int,
    annotations: Seq[String] = Nil
) {
  def fullString: String =
    Seq(
      s"${if (annotations.isEmpty) "" else annotations.mkString("", " ", " ")}",
      s"${name}: ${typeName}",
      default.fold("")(" = " + _)
    ).mkString

  def nameAndType: String = s"${name}: ${typeName}"
}

object ConstructorField {
  val UnknownFields = ConstructorField(
    name = "unknownFields",
    typeName = C.UnknownFieldSet,
    default = Some(C.UnknownFieldSetEmpty),
    index = Int.MaxValue
  )
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy