导航菜单

页面标题

页面副标题

SpeedCash v6.5.1482 - AbstractStub.java 源代码

正在查看: SpeedCash v6.5.1482 应用的 AbstractStub.java JAVA 源代码文件

本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。


package io.grpc.stub;

import com.google.common.base.Preconditions;
import io.grpc.CallCredentials;
import io.grpc.CallOptions;
import io.grpc.Channel;
import io.grpc.ClientInterceptor;
import io.grpc.ClientInterceptors;
import io.grpc.Deadline;
import io.grpc.ExperimentalApi;
import io.grpc.stub.AbstractStub;
import java.util.concurrent.Executor;
import java.util.concurrent.TimeUnit;
import javax.annotation.CheckReturnValue;
import javax.annotation.Nullable;
import javax.annotation.concurrent.ThreadSafe;

@ThreadSafe
@CheckReturnValue
public abstract class AbstractStub<S extends AbstractStub<S>> {
    public final Channel a;
    public final CallOptions b;

    public interface StubFactory<T extends AbstractStub<T>> {
        T newStub(Channel channel, CallOptions callOptions);
    }

    public AbstractStub(Channel channel) {
        this(channel, CallOptions.DEFAULT);
    }

    public static <T extends AbstractStub<T>> T newStub(StubFactory<T> stubFactory, Channel channel) {
        return (T) newStub(stubFactory, channel, CallOptions.DEFAULT);
    }

    public abstract S build(Channel channel, CallOptions callOptions);

    public final CallOptions getCallOptions() {
        return this.b;
    }

    public final Channel getChannel() {
        return this.a;
    }

    public final S withCallCredentials(CallCredentials callCredentials) {
        return build(this.a, this.b.withCallCredentials(callCredentials));
    }

    @Deprecated
    public final S withChannel(Channel channel) {
        return build(channel, this.b);
    }

    @ExperimentalApi("https://github.com/grpc/grpc-java/issues/1704")
    public final S withCompression(String str) {
        return build(this.a, this.b.withCompression(str));
    }

    public final S withDeadline(@Nullable Deadline deadline) {
        return build(this.a, this.b.withDeadline(deadline));
    }

    public final S withDeadlineAfter(long j, TimeUnit timeUnit) {
        return build(this.a, this.b.withDeadlineAfter(j, timeUnit));
    }

    public final S withExecutor(Executor executor) {
        return build(this.a, this.b.withExecutor(executor));
    }

    public final S withInterceptors(ClientInterceptor... clientInterceptorArr) {
        return build(ClientInterceptors.intercept(this.a, clientInterceptorArr), this.b);
    }

    @ExperimentalApi("https://github.com/grpc/grpc-java/issues/2563")
    public final S withMaxInboundMessageSize(int i) {
        return build(this.a, this.b.withMaxInboundMessageSize(i));
    }

    @ExperimentalApi("https://github.com/grpc/grpc-java/issues/2563")
    public final S withMaxOutboundMessageSize(int i) {
        return build(this.a, this.b.withMaxOutboundMessageSize(i));
    }

    @ExperimentalApi("https://github.com/grpc/grpc-java/issues/1869")
    public final <T> S withOption(CallOptions.Key<T> key, T t) {
        return build(this.a, this.b.withOption(key, t));
    }

    public final S withWaitForReady() {
        return build(this.a, this.b.withWaitForReady());
    }

    public AbstractStub(Channel channel, CallOptions callOptions) {
        this.a = (Channel) Preconditions.checkNotNull(channel, "channel");
        this.b = (CallOptions) Preconditions.checkNotNull(callOptions, "callOptions");
    }

    public static <T extends AbstractStub<T>> T newStub(StubFactory<T> stubFactory, Channel channel, CallOptions callOptions) {
        return stubFactory.newStub(channel, callOptions);
    }
}