io.quarkus.grpc.runtime.ClientInterceptorStorage Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of quarkus-grpc Show documentation
Show all versions of quarkus-grpc Show documentation
Serve and consume gRPC services
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;
}
}