正在查看: 逼多多 v3.6.2 应用的 MethodDescriptor.java JAVA 源代码文件
本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。
正在查看: 逼多多 v3.6.2 应用的 MethodDescriptor.java JAVA 源代码文件
本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。
package io.grpc;
import java.io.InputStream;
import java.util.concurrent.atomic.AtomicReferenceArray;
import q.g;
import q.l;
public final class MethodDescriptor<ReqT, RespT> {
static final boolean $assertionsDisabled = false;
private final String fullMethodName;
private final boolean idempotent;
private final AtomicReferenceArray<Object> rawMethodNames;
private final Marshaller<ReqT> requestMarshaller;
private final Marshaller<RespT> responseMarshaller;
private final boolean safe;
private final boolean sampledToLocalTracing;
private final Object schemaDescriptor;
private final String serviceName;
private final MethodType type;
public static final class Builder<ReqT, RespT> {
private String fullMethodName;
private boolean idempotent;
private Marshaller<ReqT> requestMarshaller;
private Marshaller<RespT> responseMarshaller;
private boolean safe;
private boolean sampledToLocalTracing;
private Object schemaDescriptor;
private MethodType type;
public MethodDescriptor<ReqT, RespT> build() {
return new MethodDescriptor<>(this.type, this.fullMethodName, this.requestMarshaller, this.responseMarshaller, this.schemaDescriptor, this.idempotent, this.safe, this.sampledToLocalTracing);
}
public Builder<ReqT, RespT> setFullMethodName(String str) {
this.fullMethodName = str;
return this;
}
public Builder<ReqT, RespT> setIdempotent(boolean z) {
this.idempotent = z;
if (!z) {
this.safe = false;
}
return this;
}
public Builder<ReqT, RespT> setRequestMarshaller(Marshaller<ReqT> marshaller) {
this.requestMarshaller = marshaller;
return this;
}
public Builder<ReqT, RespT> setResponseMarshaller(Marshaller<RespT> marshaller) {
this.responseMarshaller = marshaller;
return this;
}
public Builder<ReqT, RespT> setSafe(boolean z) {
this.safe = z;
if (z) {
this.idempotent = true;
}
return this;
}
public Builder<ReqT, RespT> setSampledToLocalTracing(boolean z) {
this.sampledToLocalTracing = z;
return this;
}
public Builder<ReqT, RespT> setSchemaDescriptor(Object obj) {
this.schemaDescriptor = obj;
return this;
}
public Builder<ReqT, RespT> setType(MethodType methodType) {
this.type = methodType;
return this;
}
private 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> {
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")
public static String extractBareMethodName(String str) {
int lastIndexOf = ((String) l.o(str, "fullMethodName")).lastIndexOf(47);
if (lastIndexOf == -1) {
return null;
}
return str.substring(lastIndexOf + 1);
}
public static String extractFullServiceName(String str) {
int lastIndexOf = ((String) l.o(str, "fullMethodName")).lastIndexOf(47);
if (lastIndexOf == -1) {
return null;
}
return str.substring(0, lastIndexOf);
}
public static String generateFullMethodName(String str, String str2) {
return ((String) l.o(str, "fullServiceName")) + "/" + ((String) l.o(str2, "methodName"));
}
public static <ReqT, RespT> Builder<ReqT, RespT> newBuilder() {
return newBuilder(null, null);
}
@ExperimentalApi("https://github.com/grpc/grpc-java/issues/5635")
public String getBareMethodName() {
return extractBareMethodName(this.fullMethodName);
}
public String getFullMethodName() {
return this.fullMethodName;
}
final Object getRawMethodName(int i) {
return this.rawMethodNames.get(i);
}
public Marshaller<ReqT> getRequestMarshaller() {
return this.requestMarshaller;
}
public Marshaller<RespT> getResponseMarshaller() {
return this.responseMarshaller;
}
public Object getSchemaDescriptor() {
return this.schemaDescriptor;
}
@ExperimentalApi("https://github.com/grpc/grpc-java/issues/5635")
public String getServiceName() {
return this.serviceName;
}
public MethodType getType() {
return this.type;
}
public boolean isIdempotent() {
return this.idempotent;
}
public boolean isSafe() {
return this.safe;
}
public boolean isSampledToLocalTracing() {
return this.sampledToLocalTracing;
}
public ReqT parseRequest(InputStream inputStream) {
return this.requestMarshaller.parse(inputStream);
}
public RespT parseResponse(InputStream inputStream) {
return this.responseMarshaller.parse(inputStream);
}
final void setRawMethodName(int i, Object obj) {
this.rawMethodNames.lazySet(i, obj);
}
public InputStream streamRequest(ReqT reqt) {
return this.requestMarshaller.stream(reqt);
}
public InputStream streamResponse(RespT respt) {
return this.responseMarshaller.stream(respt);
}
public Builder<ReqT, RespT> toBuilder() {
return (Builder<ReqT, RespT>) toBuilder(this.requestMarshaller, this.responseMarshaller);
}
public String toString() {
return g.c(this).d("fullMethodName", this.fullMethodName).d("type", this.type).e("idempotent", this.idempotent).e("safe", this.safe).e("sampledToLocalTracing", this.sampledToLocalTracing).d("requestMarshaller", this.requestMarshaller).d("responseMarshaller", this.responseMarshaller).d("schemaDescriptor", this.schemaDescriptor).k().toString();
}
private MethodDescriptor(MethodType methodType, String str, Marshaller<ReqT> marshaller, Marshaller<RespT> marshaller2, Object obj, boolean z, boolean z2, boolean z3) {
this.rawMethodNames = new AtomicReferenceArray<>(2);
this.type = (MethodType) l.o(methodType, "type");
this.fullMethodName = (String) l.o(str, "fullMethodName");
this.serviceName = extractFullServiceName(str);
this.requestMarshaller = (Marshaller) l.o(marshaller, "requestMarshaller");
this.responseMarshaller = (Marshaller) l.o(marshaller2, "responseMarshaller");
this.schemaDescriptor = obj;
this.idempotent = z;
this.safe = z2;
this.sampledToLocalTracing = z3;
}
public static <ReqT, RespT> Builder<ReqT, RespT> newBuilder(Marshaller<ReqT> marshaller, Marshaller<RespT> marshaller2) {
return new Builder().setRequestMarshaller(marshaller).setResponseMarshaller(marshaller2);
}
public <NewReqT, NewRespT> Builder<NewReqT, NewRespT> toBuilder(Marshaller<NewReqT> marshaller, Marshaller<NewRespT> marshaller2) {
return newBuilder().setRequestMarshaller(marshaller).setResponseMarshaller(marshaller2).setType(this.type).setFullMethodName(this.fullMethodName).setIdempotent(this.idempotent).setSafe(this.safe).setSampledToLocalTracing(this.sampledToLocalTracing).setSchemaDescriptor(this.schemaDescriptor);
}
}