io.grpc.serviceconfig.GrpcLbConfig Maven / Gradle / Ivy
// Generated by the protocol buffer compiler. DO NOT EDIT!
// source: service_config.proto
// Protobuf Java Version: 3.25.5
package io.grpc.serviceconfig;
/**
*
* Configuration for grpclb LB policy.
*
*
* Protobuf type {@code grpc.service_config.GrpcLbConfig}
*/
public final class GrpcLbConfig extends
com.google.protobuf.GeneratedMessageV3 implements
// @@protoc_insertion_point(message_implements:grpc.service_config.GrpcLbConfig)
GrpcLbConfigOrBuilder {
private static final long serialVersionUID = 0L;
// Use GrpcLbConfig.newBuilder() to construct.
private GrpcLbConfig(com.google.protobuf.GeneratedMessageV3.Builder> builder) {
super(builder);
}
private GrpcLbConfig() {
childPolicy_ = java.util.Collections.emptyList();
serviceName_ = "";
}
@java.lang.Override
@SuppressWarnings({"unused"})
protected java.lang.Object newInstance(
UnusedPrivateParameter unused) {
return new GrpcLbConfig();
}
public static final com.google.protobuf.Descriptors.Descriptor
getDescriptor() {
return io.grpc.serviceconfig.ServiceConfigProto.internal_static_grpc_service_config_GrpcLbConfig_descriptor;
}
@java.lang.Override
protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable
internalGetFieldAccessorTable() {
return io.grpc.serviceconfig.ServiceConfigProto.internal_static_grpc_service_config_GrpcLbConfig_fieldAccessorTable
.ensureFieldAccessorsInitialized(
io.grpc.serviceconfig.GrpcLbConfig.class, io.grpc.serviceconfig.GrpcLbConfig.Builder.class);
}
public static final int CHILD_POLICY_FIELD_NUMBER = 1;
@SuppressWarnings("serial")
private java.util.List childPolicy_;
/**
*
* Optional. What LB policy to use for routing between the backend
* addresses. If unset, defaults to round_robin.
* Currently, the only supported values are round_robin and pick_first.
* Note that this will be used both in balancer mode and in fallback mode.
* Multiple LB policies can be specified; clients will iterate through
* the list in order and stop at the first policy that they support.
*
*
* repeated .grpc.service_config.LoadBalancingConfig child_policy = 1;
*/
@java.lang.Override
public java.util.List getChildPolicyList() {
return childPolicy_;
}
/**
*
* Optional. What LB policy to use for routing between the backend
* addresses. If unset, defaults to round_robin.
* Currently, the only supported values are round_robin and pick_first.
* Note that this will be used both in balancer mode and in fallback mode.
* Multiple LB policies can be specified; clients will iterate through
* the list in order and stop at the first policy that they support.
*
*
* repeated .grpc.service_config.LoadBalancingConfig child_policy = 1;
*/
@java.lang.Override
public java.util.List extends io.grpc.serviceconfig.LoadBalancingConfigOrBuilder>
getChildPolicyOrBuilderList() {
return childPolicy_;
}
/**
*
* Optional. What LB policy to use for routing between the backend
* addresses. If unset, defaults to round_robin.
* Currently, the only supported values are round_robin and pick_first.
* Note that this will be used both in balancer mode and in fallback mode.
* Multiple LB policies can be specified; clients will iterate through
* the list in order and stop at the first policy that they support.
*
*
* repeated .grpc.service_config.LoadBalancingConfig child_policy = 1;
*/
@java.lang.Override
public int getChildPolicyCount() {
return childPolicy_.size();
}
/**
*
* Optional. What LB policy to use for routing between the backend
* addresses. If unset, defaults to round_robin.
* Currently, the only supported values are round_robin and pick_first.
* Note that this will be used both in balancer mode and in fallback mode.
* Multiple LB policies can be specified; clients will iterate through
* the list in order and stop at the first policy that they support.
*
*
* repeated .grpc.service_config.LoadBalancingConfig child_policy = 1;
*/
@java.lang.Override
public io.grpc.serviceconfig.LoadBalancingConfig getChildPolicy(int index) {
return childPolicy_.get(index);
}
/**
*
* Optional. What LB policy to use for routing between the backend
* addresses. If unset, defaults to round_robin.
* Currently, the only supported values are round_robin and pick_first.
* Note that this will be used both in balancer mode and in fallback mode.
* Multiple LB policies can be specified; clients will iterate through
* the list in order and stop at the first policy that they support.
*
*
* repeated .grpc.service_config.LoadBalancingConfig child_policy = 1;
*/
@java.lang.Override
public io.grpc.serviceconfig.LoadBalancingConfigOrBuilder getChildPolicyOrBuilder(
int index) {
return childPolicy_.get(index);
}
public static final int SERVICE_NAME_FIELD_NUMBER = 2;
@SuppressWarnings("serial")
private volatile java.lang.Object serviceName_ = "";
/**
*
* Optional. If specified, overrides the name of the service to be sent to
* the balancer.
*
*
* string service_name = 2;
* @return The serviceName.
*/
@java.lang.Override
public java.lang.String getServiceName() {
java.lang.Object ref = serviceName_;
if (ref instanceof java.lang.String) {
return (java.lang.String) ref;
} else {
com.google.protobuf.ByteString bs =
(com.google.protobuf.ByteString) ref;
java.lang.String s = bs.toStringUtf8();
serviceName_ = s;
return s;
}
}
/**
*
* Optional. If specified, overrides the name of the service to be sent to
* the balancer.
*
*
* string service_name = 2;
* @return The bytes for serviceName.
*/
@java.lang.Override
public com.google.protobuf.ByteString
getServiceNameBytes() {
java.lang.Object ref = serviceName_;
if (ref instanceof java.lang.String) {
com.google.protobuf.ByteString b =
com.google.protobuf.ByteString.copyFromUtf8(
(java.lang.String) ref);
serviceName_ = b;
return b;
} else {
return (com.google.protobuf.ByteString) ref;
}
}
private byte memoizedIsInitialized = -1;
@java.lang.Override
public final boolean isInitialized() {
byte isInitialized = memoizedIsInitialized;
if (isInitialized == 1) return true;
if (isInitialized == 0) return false;
memoizedIsInitialized = 1;
return true;
}
@java.lang.Override
public void writeTo(com.google.protobuf.CodedOutputStream output)
throws java.io.IOException {
for (int i = 0; i < childPolicy_.size(); i++) {
output.writeMessage(1, childPolicy_.get(i));
}
if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(serviceName_)) {
com.google.protobuf.GeneratedMessageV3.writeString(output, 2, serviceName_);
}
getUnknownFields().writeTo(output);
}
@java.lang.Override
public int getSerializedSize() {
int size = memoizedSize;
if (size != -1) return size;
size = 0;
for (int i = 0; i < childPolicy_.size(); i++) {
size += com.google.protobuf.CodedOutputStream
.computeMessageSize(1, childPolicy_.get(i));
}
if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(serviceName_)) {
size += com.google.protobuf.GeneratedMessageV3.computeStringSize(2, serviceName_);
}
size += getUnknownFields().getSerializedSize();
memoizedSize = size;
return size;
}
@java.lang.Override
public boolean equals(final java.lang.Object obj) {
if (obj == this) {
return true;
}
if (!(obj instanceof io.grpc.serviceconfig.GrpcLbConfig)) {
return super.equals(obj);
}
io.grpc.serviceconfig.GrpcLbConfig other = (io.grpc.serviceconfig.GrpcLbConfig) obj;
if (!getChildPolicyList()
.equals(other.getChildPolicyList())) return false;
if (!getServiceName()
.equals(other.getServiceName())) return false;
if (!getUnknownFields().equals(other.getUnknownFields())) return false;
return true;
}
@java.lang.Override
public int hashCode() {
if (memoizedHashCode != 0) {
return memoizedHashCode;
}
int hash = 41;
hash = (19 * hash) + getDescriptor().hashCode();
if (getChildPolicyCount() > 0) {
hash = (37 * hash) + CHILD_POLICY_FIELD_NUMBER;
hash = (53 * hash) + getChildPolicyList().hashCode();
}
hash = (37 * hash) + SERVICE_NAME_FIELD_NUMBER;
hash = (53 * hash) + getServiceName().hashCode();
hash = (29 * hash) + getUnknownFields().hashCode();
memoizedHashCode = hash;
return hash;
}
public static io.grpc.serviceconfig.GrpcLbConfig parseFrom(
java.nio.ByteBuffer data)
throws com.google.protobuf.InvalidProtocolBufferException {
return PARSER.parseFrom(data);
}
public static io.grpc.serviceconfig.GrpcLbConfig parseFrom(
java.nio.ByteBuffer data,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws com.google.protobuf.InvalidProtocolBufferException {
return PARSER.parseFrom(data, extensionRegistry);
}
public static io.grpc.serviceconfig.GrpcLbConfig parseFrom(
com.google.protobuf.ByteString data)
throws com.google.protobuf.InvalidProtocolBufferException {
return PARSER.parseFrom(data);
}
public static io.grpc.serviceconfig.GrpcLbConfig parseFrom(
com.google.protobuf.ByteString data,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws com.google.protobuf.InvalidProtocolBufferException {
return PARSER.parseFrom(data, extensionRegistry);
}
public static io.grpc.serviceconfig.GrpcLbConfig parseFrom(byte[] data)
throws com.google.protobuf.InvalidProtocolBufferException {
return PARSER.parseFrom(data);
}
public static io.grpc.serviceconfig.GrpcLbConfig parseFrom(
byte[] data,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws com.google.protobuf.InvalidProtocolBufferException {
return PARSER.parseFrom(data, extensionRegistry);
}
public static io.grpc.serviceconfig.GrpcLbConfig parseFrom(java.io.InputStream input)
throws java.io.IOException {
return com.google.protobuf.GeneratedMessageV3
.parseWithIOException(PARSER, input);
}
public static io.grpc.serviceconfig.GrpcLbConfig parseFrom(
java.io.InputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws java.io.IOException {
return com.google.protobuf.GeneratedMessageV3
.parseWithIOException(PARSER, input, extensionRegistry);
}
public static io.grpc.serviceconfig.GrpcLbConfig parseDelimitedFrom(java.io.InputStream input)
throws java.io.IOException {
return com.google.protobuf.GeneratedMessageV3
.parseDelimitedWithIOException(PARSER, input);
}
public static io.grpc.serviceconfig.GrpcLbConfig parseDelimitedFrom(
java.io.InputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws java.io.IOException {
return com.google.protobuf.GeneratedMessageV3
.parseDelimitedWithIOException(PARSER, input, extensionRegistry);
}
public static io.grpc.serviceconfig.GrpcLbConfig parseFrom(
com.google.protobuf.CodedInputStream input)
throws java.io.IOException {
return com.google.protobuf.GeneratedMessageV3
.parseWithIOException(PARSER, input);
}
public static io.grpc.serviceconfig.GrpcLbConfig parseFrom(
com.google.protobuf.CodedInputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws java.io.IOException {
return com.google.protobuf.GeneratedMessageV3
.parseWithIOException(PARSER, input, extensionRegistry);
}
@java.lang.Override
public Builder newBuilderForType() { return newBuilder(); }
public static Builder newBuilder() {
return DEFAULT_INSTANCE.toBuilder();
}
public static Builder newBuilder(io.grpc.serviceconfig.GrpcLbConfig prototype) {
return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype);
}
@java.lang.Override
public Builder toBuilder() {
return this == DEFAULT_INSTANCE
? new Builder() : new Builder().mergeFrom(this);
}
@java.lang.Override
protected Builder newBuilderForType(
com.google.protobuf.GeneratedMessageV3.BuilderParent parent) {
Builder builder = new Builder(parent);
return builder;
}
/**
*
* Configuration for grpclb LB policy.
*
*
* Protobuf type {@code grpc.service_config.GrpcLbConfig}
*/
public static final class Builder extends
com.google.protobuf.GeneratedMessageV3.Builder implements
// @@protoc_insertion_point(builder_implements:grpc.service_config.GrpcLbConfig)
io.grpc.serviceconfig.GrpcLbConfigOrBuilder {
public static final com.google.protobuf.Descriptors.Descriptor
getDescriptor() {
return io.grpc.serviceconfig.ServiceConfigProto.internal_static_grpc_service_config_GrpcLbConfig_descriptor;
}
@java.lang.Override
protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable
internalGetFieldAccessorTable() {
return io.grpc.serviceconfig.ServiceConfigProto.internal_static_grpc_service_config_GrpcLbConfig_fieldAccessorTable
.ensureFieldAccessorsInitialized(
io.grpc.serviceconfig.GrpcLbConfig.class, io.grpc.serviceconfig.GrpcLbConfig.Builder.class);
}
// Construct using io.grpc.serviceconfig.GrpcLbConfig.newBuilder()
private Builder() {
}
private Builder(
com.google.protobuf.GeneratedMessageV3.BuilderParent parent) {
super(parent);
}
@java.lang.Override
public Builder clear() {
super.clear();
bitField0_ = 0;
if (childPolicyBuilder_ == null) {
childPolicy_ = java.util.Collections.emptyList();
} else {
childPolicy_ = null;
childPolicyBuilder_.clear();
}
bitField0_ = (bitField0_ & ~0x00000001);
serviceName_ = "";
return this;
}
@java.lang.Override
public com.google.protobuf.Descriptors.Descriptor
getDescriptorForType() {
return io.grpc.serviceconfig.ServiceConfigProto.internal_static_grpc_service_config_GrpcLbConfig_descriptor;
}
@java.lang.Override
public io.grpc.serviceconfig.GrpcLbConfig getDefaultInstanceForType() {
return io.grpc.serviceconfig.GrpcLbConfig.getDefaultInstance();
}
@java.lang.Override
public io.grpc.serviceconfig.GrpcLbConfig build() {
io.grpc.serviceconfig.GrpcLbConfig result = buildPartial();
if (!result.isInitialized()) {
throw newUninitializedMessageException(result);
}
return result;
}
@java.lang.Override
public io.grpc.serviceconfig.GrpcLbConfig buildPartial() {
io.grpc.serviceconfig.GrpcLbConfig result = new io.grpc.serviceconfig.GrpcLbConfig(this);
buildPartialRepeatedFields(result);
if (bitField0_ != 0) { buildPartial0(result); }
onBuilt();
return result;
}
private void buildPartialRepeatedFields(io.grpc.serviceconfig.GrpcLbConfig result) {
if (childPolicyBuilder_ == null) {
if (((bitField0_ & 0x00000001) != 0)) {
childPolicy_ = java.util.Collections.unmodifiableList(childPolicy_);
bitField0_ = (bitField0_ & ~0x00000001);
}
result.childPolicy_ = childPolicy_;
} else {
result.childPolicy_ = childPolicyBuilder_.build();
}
}
private void buildPartial0(io.grpc.serviceconfig.GrpcLbConfig result) {
int from_bitField0_ = bitField0_;
if (((from_bitField0_ & 0x00000002) != 0)) {
result.serviceName_ = serviceName_;
}
}
@java.lang.Override
public Builder clone() {
return super.clone();
}
@java.lang.Override
public Builder setField(
com.google.protobuf.Descriptors.FieldDescriptor field,
java.lang.Object value) {
return super.setField(field, value);
}
@java.lang.Override
public Builder clearField(
com.google.protobuf.Descriptors.FieldDescriptor field) {
return super.clearField(field);
}
@java.lang.Override
public Builder clearOneof(
com.google.protobuf.Descriptors.OneofDescriptor oneof) {
return super.clearOneof(oneof);
}
@java.lang.Override
public Builder setRepeatedField(
com.google.protobuf.Descriptors.FieldDescriptor field,
int index, java.lang.Object value) {
return super.setRepeatedField(field, index, value);
}
@java.lang.Override
public Builder addRepeatedField(
com.google.protobuf.Descriptors.FieldDescriptor field,
java.lang.Object value) {
return super.addRepeatedField(field, value);
}
@java.lang.Override
public Builder mergeFrom(com.google.protobuf.Message other) {
if (other instanceof io.grpc.serviceconfig.GrpcLbConfig) {
return mergeFrom((io.grpc.serviceconfig.GrpcLbConfig)other);
} else {
super.mergeFrom(other);
return this;
}
}
public Builder mergeFrom(io.grpc.serviceconfig.GrpcLbConfig other) {
if (other == io.grpc.serviceconfig.GrpcLbConfig.getDefaultInstance()) return this;
if (childPolicyBuilder_ == null) {
if (!other.childPolicy_.isEmpty()) {
if (childPolicy_.isEmpty()) {
childPolicy_ = other.childPolicy_;
bitField0_ = (bitField0_ & ~0x00000001);
} else {
ensureChildPolicyIsMutable();
childPolicy_.addAll(other.childPolicy_);
}
onChanged();
}
} else {
if (!other.childPolicy_.isEmpty()) {
if (childPolicyBuilder_.isEmpty()) {
childPolicyBuilder_.dispose();
childPolicyBuilder_ = null;
childPolicy_ = other.childPolicy_;
bitField0_ = (bitField0_ & ~0x00000001);
childPolicyBuilder_ =
com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders ?
getChildPolicyFieldBuilder() : null;
} else {
childPolicyBuilder_.addAllMessages(other.childPolicy_);
}
}
}
if (!other.getServiceName().isEmpty()) {
serviceName_ = other.serviceName_;
bitField0_ |= 0x00000002;
onChanged();
}
this.mergeUnknownFields(other.getUnknownFields());
onChanged();
return this;
}
@java.lang.Override
public final boolean isInitialized() {
return true;
}
@java.lang.Override
public Builder mergeFrom(
com.google.protobuf.CodedInputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws java.io.IOException {
if (extensionRegistry == null) {
throw new java.lang.NullPointerException();
}
try {
boolean done = false;
while (!done) {
int tag = input.readTag();
switch (tag) {
case 0:
done = true;
break;
case 10: {
io.grpc.serviceconfig.LoadBalancingConfig m =
input.readMessage(
io.grpc.serviceconfig.LoadBalancingConfig.parser(),
extensionRegistry);
if (childPolicyBuilder_ == null) {
ensureChildPolicyIsMutable();
childPolicy_.add(m);
} else {
childPolicyBuilder_.addMessage(m);
}
break;
} // case 10
case 18: {
serviceName_ = input.readStringRequireUtf8();
bitField0_ |= 0x00000002;
break;
} // case 18
default: {
if (!super.parseUnknownField(input, extensionRegistry, tag)) {
done = true; // was an endgroup tag
}
break;
} // default:
} // switch (tag)
} // while (!done)
} catch (com.google.protobuf.InvalidProtocolBufferException e) {
throw e.unwrapIOException();
} finally {
onChanged();
} // finally
return this;
}
private int bitField0_;
private java.util.List childPolicy_ =
java.util.Collections.emptyList();
private void ensureChildPolicyIsMutable() {
if (!((bitField0_ & 0x00000001) != 0)) {
childPolicy_ = new java.util.ArrayList(childPolicy_);
bitField0_ |= 0x00000001;
}
}
private com.google.protobuf.RepeatedFieldBuilderV3<
io.grpc.serviceconfig.LoadBalancingConfig, io.grpc.serviceconfig.LoadBalancingConfig.Builder, io.grpc.serviceconfig.LoadBalancingConfigOrBuilder> childPolicyBuilder_;
/**
*
* Optional. What LB policy to use for routing between the backend
* addresses. If unset, defaults to round_robin.
* Currently, the only supported values are round_robin and pick_first.
* Note that this will be used both in balancer mode and in fallback mode.
* Multiple LB policies can be specified; clients will iterate through
* the list in order and stop at the first policy that they support.
*
*
* repeated .grpc.service_config.LoadBalancingConfig child_policy = 1;
*/
public java.util.List getChildPolicyList() {
if (childPolicyBuilder_ == null) {
return java.util.Collections.unmodifiableList(childPolicy_);
} else {
return childPolicyBuilder_.getMessageList();
}
}
/**
*
* Optional. What LB policy to use for routing between the backend
* addresses. If unset, defaults to round_robin.
* Currently, the only supported values are round_robin and pick_first.
* Note that this will be used both in balancer mode and in fallback mode.
* Multiple LB policies can be specified; clients will iterate through
* the list in order and stop at the first policy that they support.
*
*
* repeated .grpc.service_config.LoadBalancingConfig child_policy = 1;
*/
public int getChildPolicyCount() {
if (childPolicyBuilder_ == null) {
return childPolicy_.size();
} else {
return childPolicyBuilder_.getCount();
}
}
/**
*
* Optional. What LB policy to use for routing between the backend
* addresses. If unset, defaults to round_robin.
* Currently, the only supported values are round_robin and pick_first.
* Note that this will be used both in balancer mode and in fallback mode.
* Multiple LB policies can be specified; clients will iterate through
* the list in order and stop at the first policy that they support.
*
*
* repeated .grpc.service_config.LoadBalancingConfig child_policy = 1;
*/
public io.grpc.serviceconfig.LoadBalancingConfig getChildPolicy(int index) {
if (childPolicyBuilder_ == null) {
return childPolicy_.get(index);
} else {
return childPolicyBuilder_.getMessage(index);
}
}
/**
*
* Optional. What LB policy to use for routing between the backend
* addresses. If unset, defaults to round_robin.
* Currently, the only supported values are round_robin and pick_first.
* Note that this will be used both in balancer mode and in fallback mode.
* Multiple LB policies can be specified; clients will iterate through
* the list in order and stop at the first policy that they support.
*
*
* repeated .grpc.service_config.LoadBalancingConfig child_policy = 1;
*/
public Builder setChildPolicy(
int index, io.grpc.serviceconfig.LoadBalancingConfig value) {
if (childPolicyBuilder_ == null) {
if (value == null) {
throw new NullPointerException();
}
ensureChildPolicyIsMutable();
childPolicy_.set(index, value);
onChanged();
} else {
childPolicyBuilder_.setMessage(index, value);
}
return this;
}
/**
*
* Optional. What LB policy to use for routing between the backend
* addresses. If unset, defaults to round_robin.
* Currently, the only supported values are round_robin and pick_first.
* Note that this will be used both in balancer mode and in fallback mode.
* Multiple LB policies can be specified; clients will iterate through
* the list in order and stop at the first policy that they support.
*
*
* repeated .grpc.service_config.LoadBalancingConfig child_policy = 1;
*/
public Builder setChildPolicy(
int index, io.grpc.serviceconfig.LoadBalancingConfig.Builder builderForValue) {
if (childPolicyBuilder_ == null) {
ensureChildPolicyIsMutable();
childPolicy_.set(index, builderForValue.build());
onChanged();
} else {
childPolicyBuilder_.setMessage(index, builderForValue.build());
}
return this;
}
/**
*
* Optional. What LB policy to use for routing between the backend
* addresses. If unset, defaults to round_robin.
* Currently, the only supported values are round_robin and pick_first.
* Note that this will be used both in balancer mode and in fallback mode.
* Multiple LB policies can be specified; clients will iterate through
* the list in order and stop at the first policy that they support.
*
*
* repeated .grpc.service_config.LoadBalancingConfig child_policy = 1;
*/
public Builder addChildPolicy(io.grpc.serviceconfig.LoadBalancingConfig value) {
if (childPolicyBuilder_ == null) {
if (value == null) {
throw new NullPointerException();
}
ensureChildPolicyIsMutable();
childPolicy_.add(value);
onChanged();
} else {
childPolicyBuilder_.addMessage(value);
}
return this;
}
/**
*
* Optional. What LB policy to use for routing between the backend
* addresses. If unset, defaults to round_robin.
* Currently, the only supported values are round_robin and pick_first.
* Note that this will be used both in balancer mode and in fallback mode.
* Multiple LB policies can be specified; clients will iterate through
* the list in order and stop at the first policy that they support.
*
*
* repeated .grpc.service_config.LoadBalancingConfig child_policy = 1;
*/
public Builder addChildPolicy(
int index, io.grpc.serviceconfig.LoadBalancingConfig value) {
if (childPolicyBuilder_ == null) {
if (value == null) {
throw new NullPointerException();
}
ensureChildPolicyIsMutable();
childPolicy_.add(index, value);
onChanged();
} else {
childPolicyBuilder_.addMessage(index, value);
}
return this;
}
/**
*
* Optional. What LB policy to use for routing between the backend
* addresses. If unset, defaults to round_robin.
* Currently, the only supported values are round_robin and pick_first.
* Note that this will be used both in balancer mode and in fallback mode.
* Multiple LB policies can be specified; clients will iterate through
* the list in order and stop at the first policy that they support.
*
*
* repeated .grpc.service_config.LoadBalancingConfig child_policy = 1;
*/
public Builder addChildPolicy(
io.grpc.serviceconfig.LoadBalancingConfig.Builder builderForValue) {
if (childPolicyBuilder_ == null) {
ensureChildPolicyIsMutable();
childPolicy_.add(builderForValue.build());
onChanged();
} else {
childPolicyBuilder_.addMessage(builderForValue.build());
}
return this;
}
/**
*
* Optional. What LB policy to use for routing between the backend
* addresses. If unset, defaults to round_robin.
* Currently, the only supported values are round_robin and pick_first.
* Note that this will be used both in balancer mode and in fallback mode.
* Multiple LB policies can be specified; clients will iterate through
* the list in order and stop at the first policy that they support.
*
*
* repeated .grpc.service_config.LoadBalancingConfig child_policy = 1;
*/
public Builder addChildPolicy(
int index, io.grpc.serviceconfig.LoadBalancingConfig.Builder builderForValue) {
if (childPolicyBuilder_ == null) {
ensureChildPolicyIsMutable();
childPolicy_.add(index, builderForValue.build());
onChanged();
} else {
childPolicyBuilder_.addMessage(index, builderForValue.build());
}
return this;
}
/**
*
* Optional. What LB policy to use for routing between the backend
* addresses. If unset, defaults to round_robin.
* Currently, the only supported values are round_robin and pick_first.
* Note that this will be used both in balancer mode and in fallback mode.
* Multiple LB policies can be specified; clients will iterate through
* the list in order and stop at the first policy that they support.
*
*
* repeated .grpc.service_config.LoadBalancingConfig child_policy = 1;
*/
public Builder addAllChildPolicy(
java.lang.Iterable extends io.grpc.serviceconfig.LoadBalancingConfig> values) {
if (childPolicyBuilder_ == null) {
ensureChildPolicyIsMutable();
com.google.protobuf.AbstractMessageLite.Builder.addAll(
values, childPolicy_);
onChanged();
} else {
childPolicyBuilder_.addAllMessages(values);
}
return this;
}
/**
*
* Optional. What LB policy to use for routing between the backend
* addresses. If unset, defaults to round_robin.
* Currently, the only supported values are round_robin and pick_first.
* Note that this will be used both in balancer mode and in fallback mode.
* Multiple LB policies can be specified; clients will iterate through
* the list in order and stop at the first policy that they support.
*
*
* repeated .grpc.service_config.LoadBalancingConfig child_policy = 1;
*/
public Builder clearChildPolicy() {
if (childPolicyBuilder_ == null) {
childPolicy_ = java.util.Collections.emptyList();
bitField0_ = (bitField0_ & ~0x00000001);
onChanged();
} else {
childPolicyBuilder_.clear();
}
return this;
}
/**
*
* Optional. What LB policy to use for routing between the backend
* addresses. If unset, defaults to round_robin.
* Currently, the only supported values are round_robin and pick_first.
* Note that this will be used both in balancer mode and in fallback mode.
* Multiple LB policies can be specified; clients will iterate through
* the list in order and stop at the first policy that they support.
*
*
* repeated .grpc.service_config.LoadBalancingConfig child_policy = 1;
*/
public Builder removeChildPolicy(int index) {
if (childPolicyBuilder_ == null) {
ensureChildPolicyIsMutable();
childPolicy_.remove(index);
onChanged();
} else {
childPolicyBuilder_.remove(index);
}
return this;
}
/**
*
* Optional. What LB policy to use for routing between the backend
* addresses. If unset, defaults to round_robin.
* Currently, the only supported values are round_robin and pick_first.
* Note that this will be used both in balancer mode and in fallback mode.
* Multiple LB policies can be specified; clients will iterate through
* the list in order and stop at the first policy that they support.
*
*
* repeated .grpc.service_config.LoadBalancingConfig child_policy = 1;
*/
public io.grpc.serviceconfig.LoadBalancingConfig.Builder getChildPolicyBuilder(
int index) {
return getChildPolicyFieldBuilder().getBuilder(index);
}
/**
*
* Optional. What LB policy to use for routing between the backend
* addresses. If unset, defaults to round_robin.
* Currently, the only supported values are round_robin and pick_first.
* Note that this will be used both in balancer mode and in fallback mode.
* Multiple LB policies can be specified; clients will iterate through
* the list in order and stop at the first policy that they support.
*
*
* repeated .grpc.service_config.LoadBalancingConfig child_policy = 1;
*/
public io.grpc.serviceconfig.LoadBalancingConfigOrBuilder getChildPolicyOrBuilder(
int index) {
if (childPolicyBuilder_ == null) {
return childPolicy_.get(index); } else {
return childPolicyBuilder_.getMessageOrBuilder(index);
}
}
/**
*
* Optional. What LB policy to use for routing between the backend
* addresses. If unset, defaults to round_robin.
* Currently, the only supported values are round_robin and pick_first.
* Note that this will be used both in balancer mode and in fallback mode.
* Multiple LB policies can be specified; clients will iterate through
* the list in order and stop at the first policy that they support.
*
*
* repeated .grpc.service_config.LoadBalancingConfig child_policy = 1;
*/
public java.util.List extends io.grpc.serviceconfig.LoadBalancingConfigOrBuilder>
getChildPolicyOrBuilderList() {
if (childPolicyBuilder_ != null) {
return childPolicyBuilder_.getMessageOrBuilderList();
} else {
return java.util.Collections.unmodifiableList(childPolicy_);
}
}
/**
*
* Optional. What LB policy to use for routing between the backend
* addresses. If unset, defaults to round_robin.
* Currently, the only supported values are round_robin and pick_first.
* Note that this will be used both in balancer mode and in fallback mode.
* Multiple LB policies can be specified; clients will iterate through
* the list in order and stop at the first policy that they support.
*
*
* repeated .grpc.service_config.LoadBalancingConfig child_policy = 1;
*/
public io.grpc.serviceconfig.LoadBalancingConfig.Builder addChildPolicyBuilder() {
return getChildPolicyFieldBuilder().addBuilder(
io.grpc.serviceconfig.LoadBalancingConfig.getDefaultInstance());
}
/**
*
* Optional. What LB policy to use for routing between the backend
* addresses. If unset, defaults to round_robin.
* Currently, the only supported values are round_robin and pick_first.
* Note that this will be used both in balancer mode and in fallback mode.
* Multiple LB policies can be specified; clients will iterate through
* the list in order and stop at the first policy that they support.
*
*
* repeated .grpc.service_config.LoadBalancingConfig child_policy = 1;
*/
public io.grpc.serviceconfig.LoadBalancingConfig.Builder addChildPolicyBuilder(
int index) {
return getChildPolicyFieldBuilder().addBuilder(
index, io.grpc.serviceconfig.LoadBalancingConfig.getDefaultInstance());
}
/**
*
* Optional. What LB policy to use for routing between the backend
* addresses. If unset, defaults to round_robin.
* Currently, the only supported values are round_robin and pick_first.
* Note that this will be used both in balancer mode and in fallback mode.
* Multiple LB policies can be specified; clients will iterate through
* the list in order and stop at the first policy that they support.
*
*
* repeated .grpc.service_config.LoadBalancingConfig child_policy = 1;
*/
public java.util.List
getChildPolicyBuilderList() {
return getChildPolicyFieldBuilder().getBuilderList();
}
private com.google.protobuf.RepeatedFieldBuilderV3<
io.grpc.serviceconfig.LoadBalancingConfig, io.grpc.serviceconfig.LoadBalancingConfig.Builder, io.grpc.serviceconfig.LoadBalancingConfigOrBuilder>
getChildPolicyFieldBuilder() {
if (childPolicyBuilder_ == null) {
childPolicyBuilder_ = new com.google.protobuf.RepeatedFieldBuilderV3<
io.grpc.serviceconfig.LoadBalancingConfig, io.grpc.serviceconfig.LoadBalancingConfig.Builder, io.grpc.serviceconfig.LoadBalancingConfigOrBuilder>(
childPolicy_,
((bitField0_ & 0x00000001) != 0),
getParentForChildren(),
isClean());
childPolicy_ = null;
}
return childPolicyBuilder_;
}
private java.lang.Object serviceName_ = "";
/**
*
* Optional. If specified, overrides the name of the service to be sent to
* the balancer.
*
*
* string service_name = 2;
* @return The serviceName.
*/
public java.lang.String getServiceName() {
java.lang.Object ref = serviceName_;
if (!(ref instanceof java.lang.String)) {
com.google.protobuf.ByteString bs =
(com.google.protobuf.ByteString) ref;
java.lang.String s = bs.toStringUtf8();
serviceName_ = s;
return s;
} else {
return (java.lang.String) ref;
}
}
/**
*
* Optional. If specified, overrides the name of the service to be sent to
* the balancer.
*
*
* string service_name = 2;
* @return The bytes for serviceName.
*/
public com.google.protobuf.ByteString
getServiceNameBytes() {
java.lang.Object ref = serviceName_;
if (ref instanceof String) {
com.google.protobuf.ByteString b =
com.google.protobuf.ByteString.copyFromUtf8(
(java.lang.String) ref);
serviceName_ = b;
return b;
} else {
return (com.google.protobuf.ByteString) ref;
}
}
/**
*
* Optional. If specified, overrides the name of the service to be sent to
* the balancer.
*
*
* string service_name = 2;
* @param value The serviceName to set.
* @return This builder for chaining.
*/
public Builder setServiceName(
java.lang.String value) {
if (value == null) { throw new NullPointerException(); }
serviceName_ = value;
bitField0_ |= 0x00000002;
onChanged();
return this;
}
/**
*
* Optional. If specified, overrides the name of the service to be sent to
* the balancer.
*
*
* string service_name = 2;
* @return This builder for chaining.
*/
public Builder clearServiceName() {
serviceName_ = getDefaultInstance().getServiceName();
bitField0_ = (bitField0_ & ~0x00000002);
onChanged();
return this;
}
/**
*
* Optional. If specified, overrides the name of the service to be sent to
* the balancer.
*
*
* string service_name = 2;
* @param value The bytes for serviceName to set.
* @return This builder for chaining.
*/
public Builder setServiceNameBytes(
com.google.protobuf.ByteString value) {
if (value == null) { throw new NullPointerException(); }
checkByteStringIsUtf8(value);
serviceName_ = value;
bitField0_ |= 0x00000002;
onChanged();
return this;
}
@java.lang.Override
public final Builder setUnknownFields(
final com.google.protobuf.UnknownFieldSet unknownFields) {
return super.setUnknownFields(unknownFields);
}
@java.lang.Override
public final Builder mergeUnknownFields(
final com.google.protobuf.UnknownFieldSet unknownFields) {
return super.mergeUnknownFields(unknownFields);
}
// @@protoc_insertion_point(builder_scope:grpc.service_config.GrpcLbConfig)
}
// @@protoc_insertion_point(class_scope:grpc.service_config.GrpcLbConfig)
private static final io.grpc.serviceconfig.GrpcLbConfig DEFAULT_INSTANCE;
static {
DEFAULT_INSTANCE = new io.grpc.serviceconfig.GrpcLbConfig();
}
public static io.grpc.serviceconfig.GrpcLbConfig getDefaultInstance() {
return DEFAULT_INSTANCE;
}
private static final com.google.protobuf.Parser
PARSER = new com.google.protobuf.AbstractParser() {
@java.lang.Override
public GrpcLbConfig parsePartialFrom(
com.google.protobuf.CodedInputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws com.google.protobuf.InvalidProtocolBufferException {
Builder builder = newBuilder();
try {
builder.mergeFrom(input, extensionRegistry);
} catch (com.google.protobuf.InvalidProtocolBufferException e) {
throw e.setUnfinishedMessage(builder.buildPartial());
} catch (com.google.protobuf.UninitializedMessageException e) {
throw e.asInvalidProtocolBufferException().setUnfinishedMessage(builder.buildPartial());
} catch (java.io.IOException e) {
throw new com.google.protobuf.InvalidProtocolBufferException(e)
.setUnfinishedMessage(builder.buildPartial());
}
return builder.buildPartial();
}
};
public static com.google.protobuf.Parser parser() {
return PARSER;
}
@java.lang.Override
public com.google.protobuf.Parser getParserForType() {
return PARSER;
}
@java.lang.Override
public io.grpc.serviceconfig.GrpcLbConfig getDefaultInstanceForType() {
return DEFAULT_INSTANCE;
}
}