Class ProtoGenerator.Options

java.lang.Object
io.github.anupambasak.gradle.plugins.pojo2proto.ProtoGenerator.Options
Enclosing class:
ProtoGenerator

public static final class ProtoGenerator.Options extends Object
Generation settings. Defaults reproduce the original behaviour: one shared proto package, no name suffix.
  • Constructor Details

    • Options

      public Options()
  • Method Details

    • prefixEnumNames

      public ProtoGenerator.Options prefixEnumNames(boolean prefixEnumNames)
      Prefix enum values with the enum name in UPPER_SNAKE_CASE.
    • nameSuffix

      public ProtoGenerator.Options nameSuffix(String nameSuffix)
      Appended to the name of every generated top-level message and enum (and so to its file name): Address -> AddressProto in AddressProto.proto.
    • usePojoPackages

      public ProtoGenerator.Options usePojoPackages(boolean usePojoPackages)
      Use each POJO's Java package as the proto package and write its file into the matching directory (com.x.dtos.Address -> com/x/dtos/Address.proto).
    • sharedPackage

      public ProtoGenerator.Options sharedPackage(String sharedPackage)
      The proto package shared by all files when usePojoPackages is off; ignored with it. The Gradle task passes packageName, which defaults to the project's group.
    • javaPackageSuffix

      public ProtoGenerator.Options javaPackageSuffix(String javaPackageSuffix)
      Appended to the Java package to form option java_package, e.g. ".proto". With usePojoPackages it is part of the proto package and directory as well (com.x.dtos.Address -> com/x/dtos/proto/AddressProto.proto, package com.x.dtos.proto), so file location, proto package and java_package all match. With the shared package it only affects java_package.