com.google.protobuf.OptionKt.kt Maven / Gradle / Ivy
// Generated by the protocol buffer compiler. DO NOT EDIT!
// source: google/protobuf/type.proto
// Generated files should ignore deprecation warnings
@file:Suppress("DEPRECATION")
package com.google.protobuf;
@kotlin.jvm.JvmName("-initializeoption")
public inline fun option(block: com.google.protobuf.OptionKt.Dsl.() -> kotlin.Unit): com.google.protobuf.Option =
com.google.protobuf.OptionKt.Dsl._create(com.google.protobuf.Option.newBuilder()).apply { block() }._build()
/**
* ```
* A protocol buffer option, which can be attached to a message, field,
* enumeration, etc.
* ```
*
* Protobuf type `google.protobuf.Option`
*/
public object OptionKt {
@kotlin.OptIn(com.google.protobuf.kotlin.OnlyForUseByGeneratedProtoCode::class)
@com.google.protobuf.kotlin.ProtoDslMarker
public class Dsl private constructor(
private val _builder: com.google.protobuf.Option.Builder
) {
public companion object {
@kotlin.jvm.JvmSynthetic
@kotlin.PublishedApi
internal fun _create(builder: com.google.protobuf.Option.Builder): Dsl = Dsl(builder)
}
@kotlin.jvm.JvmSynthetic
@kotlin.PublishedApi
internal fun _build(): com.google.protobuf.Option = _builder.build()
/**
* ```
* The option's name. For protobuf built-in options (options defined in
* descriptor.proto), this is the short name. For example, `"map_entry"`.
* For custom options, it should be the fully-qualified name. For example,
* `"google.api.http"`.
* ```
*
* `string name = 1;`
*/
public var name: kotlin.String
@JvmName("getName")
get() = _builder.getName()
@JvmName("setName")
set(value) {
_builder.setName(value)
}
/**
* ```
* The option's name. For protobuf built-in options (options defined in
* descriptor.proto), this is the short name. For example, `"map_entry"`.
* For custom options, it should be the fully-qualified name. For example,
* `"google.api.http"`.
* ```
*
* `string name = 1;`
*/
public fun clearName() {
_builder.clearName()
}
/**
* ```
* The option's value packed in an Any message. If the value is a primitive,
* the corresponding wrapper type defined in google/protobuf/wrappers.proto
* should be used. If the value is an enum, it should be stored as an int32
* value using the google.protobuf.Int32Value type.
* ```
*
* `.google.protobuf.Any value = 2;`
*/
public var value: com.google.protobuf.Any
@JvmName("getValue")
get() = _builder.getValue()
@JvmName("setValue")
set(value) {
_builder.setValue(value)
}
/**
* ```
* The option's value packed in an Any message. If the value is a primitive,
* the corresponding wrapper type defined in google/protobuf/wrappers.proto
* should be used. If the value is an enum, it should be stored as an int32
* value using the google.protobuf.Int32Value type.
* ```
*
* `.google.protobuf.Any value = 2;`
*/
public fun clearValue() {
_builder.clearValue()
}
/**
* ```
* The option's value packed in an Any message. If the value is a primitive,
* the corresponding wrapper type defined in google/protobuf/wrappers.proto
* should be used. If the value is an enum, it should be stored as an int32
* value using the google.protobuf.Int32Value type.
* ```
*
* `.google.protobuf.Any value = 2;`
* @return Whether the value field is set.
*/
public fun hasValue(): kotlin.Boolean {
return _builder.hasValue()
}
}
}
@kotlin.jvm.JvmSynthetic
public inline fun com.google.protobuf.Option.copy(block: `com.google.protobuf`.OptionKt.Dsl.() -> kotlin.Unit): com.google.protobuf.Option =
`com.google.protobuf`.OptionKt.Dsl._create(this.toBuilder()).apply { block() }._build()
public val com.google.protobuf.OptionOrBuilder.valueOrNull: com.google.protobuf.Any?
get() = if (hasValue()) getValue() else null