导航菜单

页面标题

页面副标题

SpeedCash v6.5.1482 - ServiceDescriptor.java 源代码

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

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


package io.grpc;

import com.google.common.base.MoreObjects;
import com.google.common.base.Preconditions;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.Collections;
import java.util.HashSet;
import java.util.List;
import javax.annotation.Nullable;

public final class ServiceDescriptor {
    public final String a;
    public final Collection<MethodDescriptor<?, ?>> b;
    public final Object c;

    public static final class Builder {
        public String a;
        public List<MethodDescriptor<?, ?>> b;
        public Object c;

        public Builder addMethod(MethodDescriptor<?, ?> methodDescriptor) {
            this.b.add((MethodDescriptor) Preconditions.checkNotNull(methodDescriptor, "method"));
            return this;
        }

        public ServiceDescriptor build() {
            return new ServiceDescriptor(this);
        }

        public final Builder e(Collection<MethodDescriptor<?, ?>> collection) {
            this.b.addAll(collection);
            return this;
        }

        @ExperimentalApi("https://github.com/grpc/grpc-java/issues/2666")
        public Builder setName(String str) {
            this.a = (String) Preconditions.checkNotNull(str, "name");
            return this;
        }

        public Builder setSchemaDescriptor(@Nullable Object obj) {
            this.c = obj;
            return this;
        }

        public Builder(String str) {
            this.b = new ArrayList();
            setName(str);
        }
    }

    public static void a(String str, Collection<MethodDescriptor<?, ?>> collection) {
        HashSet hashSet = new HashSet(collection.size());
        for (MethodDescriptor<?, ?> methodDescriptor : collection) {
            Preconditions.checkNotNull(methodDescriptor, "method");
            String serviceName = methodDescriptor.getServiceName();
            Preconditions.checkArgument(str.equals(serviceName), "service names %s != %s", serviceName, str);
            Preconditions.checkArgument(hashSet.add(methodDescriptor.getFullMethodName()), "duplicate name %s", methodDescriptor.getFullMethodName());
        }
    }

    public static Builder newBuilder(String str) {
        return new Builder(str);
    }

    public Collection<MethodDescriptor<?, ?>> getMethods() {
        return this.b;
    }

    public String getName() {
        return this.a;
    }

    @ExperimentalApi("https://github.com/grpc/grpc-java/issues/2222")
    @Nullable
    public Object getSchemaDescriptor() {
        return this.c;
    }

    public String toString() {
        return MoreObjects.toStringHelper(this).add("name", this.a).add("schemaDescriptor", this.c).add("methods", this.b).omitNullValues().toString();
    }

    public ServiceDescriptor(String str, MethodDescriptor<?, ?>... methodDescriptorArr) {
        this(str, Arrays.asList(methodDescriptorArr));
    }

    public ServiceDescriptor(String str, Collection<MethodDescriptor<?, ?>> collection) {
        this(newBuilder(str).e((Collection) Preconditions.checkNotNull(collection, "methods")));
    }

    public ServiceDescriptor(Builder builder) {
        String str = builder.a;
        this.a = str;
        a(str, builder.b);
        this.b = Collections.unmodifiableList(new ArrayList(builder.b));
        this.c = builder.c;
    }
}