导航菜单

页面标题

页面副标题

SpeedCash v6.5.1482 - MethodDescriptor.java 源代码

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

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


package io.grpc;

import com.google.common.base.MoreObjects;
import com.google.common.base.Preconditions;
import java.io.InputStream;
import java.util.concurrent.atomic.AtomicReferenceArray;
import javax.annotation.CheckReturnValue;
import javax.annotation.Nullable;
import javax.annotation.concurrent.Immutable;

@Immutable
public final class MethodDescriptor<ReqT, RespT> {
    public final MethodType a;
    public final String b;

    @Nullable
    public final String c;
    public final Marshaller<ReqT> d;
    public final Marshaller<RespT> e;

    @Nullable
    public final Object f;
    public final boolean g;
    public final boolean h;
    public final boolean i;
    public final AtomicReferenceArray<Object> j;

    public static final class Builder<ReqT, RespT> {
        public Marshaller<ReqT> a;
        public Marshaller<RespT> b;
        public MethodType c;
        public String d;
        public boolean e;
        public boolean f;
        public Object g;
        public boolean h;

        @CheckReturnValue
        public MethodDescriptor<ReqT, RespT> build() {
            return new MethodDescriptor<>(this.c, this.d, this.a, this.b, this.g, this.e, this.f, this.h);
        }

        public Builder<ReqT, RespT> setFullMethodName(String str) {
            this.d = str;
            return this;
        }

        public Builder<ReqT, RespT> setIdempotent(boolean z) {
            this.e = z;
            if (!z) {
                this.f = false;
            }
            return this;
        }

        public Builder<ReqT, RespT> setRequestMarshaller(Marshaller<ReqT> marshaller) {
            this.a = marshaller;
            return this;
        }

        public Builder<ReqT, RespT> setResponseMarshaller(Marshaller<RespT> marshaller) {
            this.b = marshaller;
            return this;
        }

        public Builder<ReqT, RespT> setSafe(boolean z) {
            this.f = z;
            if (z) {
                this.e = true;
            }
            return this;
        }

        public Builder<ReqT, RespT> setSampledToLocalTracing(boolean z) {
            this.h = z;
            return this;
        }

        public Builder<ReqT, RespT> setSchemaDescriptor(@Nullable Object obj) {
            this.g = obj;
            return this;
        }

        public Builder<ReqT, RespT> setType(MethodType methodType) {
            this.c = methodType;
            return this;
        }

        public Builder() {
        }
    }

    public interface Marshaller<T> {
        T parse(InputStream inputStream);

        InputStream stream(T t);
    }

    public enum MethodType {
        UNARY,
        CLIENT_STREAMING,
        SERVER_STREAMING,
        BIDI_STREAMING,
        UNKNOWN;

        public final boolean clientSendsOneMessage() {
            return this == UNARY || this == SERVER_STREAMING;
        }

        public final boolean serverSendsOneMessage() {
            return this == UNARY || this == CLIENT_STREAMING;
        }
    }

    @ExperimentalApi("https://github.com/grpc/grpc-java/issues/2222")
    public interface PrototypeMarshaller<T> extends ReflectableMarshaller<T> {
        @Nullable
        T getMessagePrototype();
    }

    @ExperimentalApi("https://github.com/grpc/grpc-java/issues/2222")
    public interface ReflectableMarshaller<T> extends Marshaller<T> {
        Class<T> getMessageClass();
    }

    @Deprecated
    public static <RequestT, ResponseT> MethodDescriptor<RequestT, ResponseT> create(MethodType methodType, String str, Marshaller<RequestT> marshaller, Marshaller<ResponseT> marshaller2) {
        return new MethodDescriptor<>(methodType, str, marshaller, marshaller2, null, false, false, false);
    }

    @ExperimentalApi("https://github.com/grpc/grpc-java/issues/5635")
    @Nullable
    public static String extractBareMethodName(String str) {
        int lastIndexOf = ((String) Preconditions.checkNotNull(str, "fullMethodName")).lastIndexOf(47);
        if (lastIndexOf == -1) {
            return null;
        }
        return str.substring(lastIndexOf + 1);
    }

    @Nullable
    public static String extractFullServiceName(String str) {
        int lastIndexOf = ((String) Preconditions.checkNotNull(str, "fullMethodName")).lastIndexOf(47);
        if (lastIndexOf == -1) {
            return null;
        }
        return str.substring(0, lastIndexOf);
    }

    public static String generateFullMethodName(String str, String str2) {
        return ((String) Preconditions.checkNotNull(str, "fullServiceName")) + "/" + ((String) Preconditions.checkNotNull(str2, "methodName"));
    }

    @CheckReturnValue
    public static <ReqT, RespT> Builder<ReqT, RespT> newBuilder() {
        return newBuilder(null, null);
    }

    public final Object a(int i) {
        return this.j.get(i);
    }

    public final void b(int i, Object obj) {
        this.j.lazySet(i, obj);
    }

    @ExperimentalApi("https://github.com/grpc/grpc-java/issues/5635")
    @Nullable
    public String getBareMethodName() {
        return extractBareMethodName(this.b);
    }

    public String getFullMethodName() {
        return this.b;
    }

    @ExperimentalApi("https://github.com/grpc/grpc-java/issues/2592")
    public Marshaller<ReqT> getRequestMarshaller() {
        return this.d;
    }

    @ExperimentalApi("https://github.com/grpc/grpc-java/issues/2592")
    public Marshaller<RespT> getResponseMarshaller() {
        return this.e;
    }

    @Nullable
    public Object getSchemaDescriptor() {
        return this.f;
    }

    @ExperimentalApi("https://github.com/grpc/grpc-java/issues/5635")
    @Nullable
    public String getServiceName() {
        return this.c;
    }

    public MethodType getType() {
        return this.a;
    }

    public boolean isIdempotent() {
        return this.g;
    }

    public boolean isSafe() {
        return this.h;
    }

    public boolean isSampledToLocalTracing() {
        return this.i;
    }

    public ReqT parseRequest(InputStream inputStream) {
        return this.d.parse(inputStream);
    }

    public RespT parseResponse(InputStream inputStream) {
        return this.e.parse(inputStream);
    }

    public InputStream streamRequest(ReqT reqt) {
        return this.d.stream(reqt);
    }

    public InputStream streamResponse(RespT respt) {
        return this.e.stream(respt);
    }

    @CheckReturnValue
    public Builder<ReqT, RespT> toBuilder() {
        return (Builder<ReqT, RespT>) toBuilder(this.d, this.e);
    }

    public String toString() {
        return MoreObjects.toStringHelper(this).add("fullMethodName", this.b).add("type", this.a).add("idempotent", this.g).add("safe", this.h).add("sampledToLocalTracing", this.i).add("requestMarshaller", this.d).add("responseMarshaller", this.e).add("schemaDescriptor", this.f).omitNullValues().toString();
    }

    public MethodDescriptor(MethodType methodType, String str, Marshaller<ReqT> marshaller, Marshaller<RespT> marshaller2, Object obj, boolean z, boolean z2, boolean z3) {
        this.j = new AtomicReferenceArray<>(2);
        this.a = (MethodType) Preconditions.checkNotNull(methodType, "type");
        this.b = (String) Preconditions.checkNotNull(str, "fullMethodName");
        this.c = extractFullServiceName(str);
        this.d = (Marshaller) Preconditions.checkNotNull(marshaller, "requestMarshaller");
        this.e = (Marshaller) Preconditions.checkNotNull(marshaller2, "responseMarshaller");
        this.f = obj;
        this.g = z;
        this.h = z2;
        this.i = z3;
    }

    @CheckReturnValue
    public static <ReqT, RespT> Builder<ReqT, RespT> newBuilder(Marshaller<ReqT> marshaller, Marshaller<RespT> marshaller2) {
        return new Builder().setRequestMarshaller(marshaller).setResponseMarshaller(marshaller2);
    }

    @CheckReturnValue
    public <NewReqT, NewRespT> Builder<NewReqT, NewRespT> toBuilder(Marshaller<NewReqT> marshaller, Marshaller<NewRespT> marshaller2) {
        return newBuilder().setRequestMarshaller(marshaller).setResponseMarshaller(marshaller2).setType(this.a).setFullMethodName(this.b).setIdempotent(this.g).setSafe(this.h).setSampledToLocalTracing(this.i).setSchemaDescriptor(this.f);
    }
}