导航菜单

页面标题

页面副标题

SpeedCash v6.5.1482 - MetadataUtils.java 源代码

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

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


package io.grpc.stub;

import com.google.common.base.Preconditions;
import com.google.errorprone.annotations.InlineMe;
import io.grpc.CallOptions;
import io.grpc.Channel;
import io.grpc.ClientCall;
import io.grpc.ClientInterceptor;
import io.grpc.ExperimentalApi;
import io.grpc.ForwardingClientCall;
import io.grpc.ForwardingClientCallListener;
import io.grpc.Metadata;
import io.grpc.MethodDescriptor;
import io.grpc.Status;
import java.util.concurrent.atomic.AtomicReference;

public final class MetadataUtils {

    public static final class a implements ClientInterceptor {
        public final Metadata a;

        public final class C0018a<ReqT, RespT> extends ForwardingClientCall.SimpleForwardingClientCall<ReqT, RespT> {
            public C0018a(ClientCall<ReqT, RespT> clientCall) {
                super(clientCall);
            }

            public void start(ClientCall.Listener<RespT> listener, Metadata metadata) {
                metadata.merge(a.this.a);
                super/*io.grpc.ForwardingClientCall*/.start(listener, metadata);
            }
        }

        public a(Metadata metadata) {
            this.a = (Metadata) Preconditions.checkNotNull(metadata, "extraHeaders");
        }

        public <ReqT, RespT> ClientCall<ReqT, RespT> interceptCall(MethodDescriptor<ReqT, RespT> methodDescriptor, CallOptions callOptions, Channel channel) {
            return new C0018a(channel.newCall(methodDescriptor, callOptions));
        }
    }

    public static final class b implements ClientInterceptor {
        public final AtomicReference<Metadata> a;
        public final AtomicReference<Metadata> b;

        public final class a<ReqT, RespT> extends ForwardingClientCall.SimpleForwardingClientCall<ReqT, RespT> {

            public final class C0019a extends ForwardingClientCallListener.SimpleForwardingClientCallListener<RespT> {
                public C0019a(ClientCall.Listener<RespT> listener) {
                    super(listener);
                }

                public void onClose(Status status, Metadata metadata) {
                    b.this.b.set(metadata);
                    super.onClose(status, metadata);
                }

                public void onHeaders(Metadata metadata) {
                    b.this.a.set(metadata);
                    super.onHeaders(metadata);
                }
            }

            public a(ClientCall<ReqT, RespT> clientCall) {
                super(clientCall);
            }

            public void start(ClientCall.Listener<RespT> listener, Metadata metadata) {
                b.this.a.set(null);
                b.this.b.set(null);
                super/*io.grpc.ForwardingClientCall*/.start(new C0019a(listener), metadata);
            }
        }

        public b(AtomicReference<Metadata> atomicReference, AtomicReference<Metadata> atomicReference2) {
            this.a = (AtomicReference) Preconditions.checkNotNull(atomicReference, "headersCapture");
            this.b = (AtomicReference) Preconditions.checkNotNull(atomicReference2, "trailersCapture");
        }

        public <ReqT, RespT> ClientCall<ReqT, RespT> interceptCall(MethodDescriptor<ReqT, RespT> methodDescriptor, CallOptions callOptions, Channel channel) {
            return new a(channel.newCall(methodDescriptor, callOptions));
        }
    }

    @InlineMe(imports = {"io.grpc.stub.MetadataUtils"}, replacement = "stub.withInterceptors(MetadataUtils.newAttachHeadersInterceptor(extraHeaders))")
    @ExperimentalApi("https://github.com/grpc/grpc-java/issues/1789")
    @Deprecated
    public static <T extends AbstractStub<T>> T attachHeaders(T t, Metadata metadata) {
        return (T) t.withInterceptors(newAttachHeadersInterceptor(metadata));
    }

    @InlineMe(imports = {"io.grpc.stub.MetadataUtils"}, replacement = "stub.withInterceptors(MetadataUtils.newCaptureMetadataInterceptor(headersCapture, trailersCapture))")
    @ExperimentalApi("https://github.com/grpc/grpc-java/issues/1789")
    @Deprecated
    public static <T extends AbstractStub<T>> T captureMetadata(T t, AtomicReference<Metadata> atomicReference, AtomicReference<Metadata> atomicReference2) {
        return (T) t.withInterceptors(newCaptureMetadataInterceptor(atomicReference, atomicReference2));
    }

    public static ClientInterceptor newAttachHeadersInterceptor(Metadata metadata) {
        return new a(metadata);
    }

    public static ClientInterceptor newCaptureMetadataInterceptor(AtomicReference<Metadata> atomicReference, AtomicReference<Metadata> atomicReference2) {
        return new b(atomicReference, atomicReference2);
    }
}