All Downloads are FREE. Search and download functionalities are using the official Maven repository.

io.quarkus.grpc.runtime.ClientInterceptorStorage Maven / Gradle / Ivy

There is a newer version: 3.15.1
Show newest version
package io.quarkus.grpc.runtime;

import java.util.HashSet;
import java.util.Set;

public final class ClientInterceptorStorage {

    private final Set> perClientInterceptors;
    private final Set> globalInterceptors;

    public ClientInterceptorStorage(Set> perClientInterceptors,
            Set> globalInterceptors) {
        this.perClientInterceptors = Set.copyOf(perClientInterceptors);
        this.globalInterceptors = Set.copyOf(globalInterceptors);
    }

    public Set> getPerClientInterceptors(Set interceptorClasses) {
        Set> ret = new HashSet>();
        for (Class interceptor : perClientInterceptors) {
            if (interceptorClasses.contains(interceptor.getName())) {
                ret.add(interceptor);
            }
        }
        return ret;
    }

    public Class getPerClientInterceptor(String interceptorClass) {
        for (Class interceptor : perClientInterceptors) {
            if (interceptor.getName().equals(interceptorClass)) {
                return interceptor;
            }
        }
        return null;
    }

    public Set> getGlobalInterceptors() {
        return globalInterceptors;
    }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy