what-the-bank/sources/io/grpc/InternalConfigSelector.java

72 lines
2.3 KiB
Java

package io.grpc;
import com.google.common.base.Preconditions;
import com.huawei.hms.support.feature.result.CommonConstant;
import io.grpc.Attributes;
import io.grpc.LoadBalancer;
/* loaded from: classes6.dex */
public abstract class InternalConfigSelector {
public static final Attributes.Key<InternalConfigSelector> KEY = Attributes.Key.create("io.grpc.config-selector");
public abstract Result selectConfig(LoadBalancer.PickSubchannelArgs pickSubchannelArgs);
/* loaded from: classes6.dex */
public static final class Result {
private final Object config;
public ClientInterceptor interceptor;
private final Status status;
private Result(Status status, Object obj, ClientInterceptor clientInterceptor) {
this.status = (Status) Preconditions.checkNotNull(status, CommonConstant.KEY_STATUS);
this.config = obj;
this.interceptor = clientInterceptor;
}
public static Result forError(Status status) {
Preconditions.checkArgument(!status.isOk(), "status is OK");
return new Result(status, null, null);
}
public static Builder newBuilder() {
return new Builder();
}
/* loaded from: classes6.dex */
public static final class Builder {
private Object config;
private ClientInterceptor interceptor;
private Builder() {
}
public final Builder setConfig(Object obj) {
this.config = Preconditions.checkNotNull(obj, "config");
return this;
}
public final Builder setInterceptor(ClientInterceptor clientInterceptor) {
this.interceptor = (ClientInterceptor) Preconditions.checkNotNull(clientInterceptor, "interceptor");
return this;
}
public final Result build() {
Preconditions.checkState(this.config != null, "config is not set");
return new Result(Status.OK, this.config, this.interceptor);
}
}
public final Status getStatus() {
return this.status;
}
public final ClientInterceptor getInterceptor() {
return this.interceptor;
}
public final Object getConfig() {
return this.config;
}
}
}