forked from quarkusio/quarkus
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- resolves quarkusio#21648 - make the RegisterInterceptor annotaion repeatable - refactor server interceptors
- Loading branch information
Showing
32 changed files
with
814 additions
and
385 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
203 changes: 157 additions & 46 deletions
203
extensions/grpc/deployment/src/main/java/io/quarkus/grpc/deployment/GrpcClientProcessor.java
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
43 changes: 43 additions & 0 deletions
43
extensions/grpc/deployment/src/main/java/io/quarkus/grpc/deployment/GrpcInterceptors.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
package io.quarkus.grpc.deployment; | ||
|
||
import static io.quarkus.grpc.deployment.GrpcDotNames.GLOBAL_INTERCEPTOR; | ||
|
||
import java.lang.reflect.Modifier; | ||
import java.util.Collection; | ||
import java.util.HashSet; | ||
import java.util.Set; | ||
|
||
import org.jboss.jandex.ClassInfo; | ||
import org.jboss.jandex.DotName; | ||
import org.jboss.jandex.IndexView; | ||
|
||
final class GrpcInterceptors { | ||
|
||
final Set<String> globalInterceptors; | ||
final Set<String> nonGlobalInterceptors; | ||
|
||
GrpcInterceptors(Set<String> globalInterceptors, Set<String> nonGlobalInterceptors) { | ||
this.globalInterceptors = globalInterceptors; | ||
this.nonGlobalInterceptors = nonGlobalInterceptors; | ||
} | ||
|
||
static GrpcInterceptors gatherInterceptors(IndexView index, DotName interceptorInterface) { | ||
Set<String> globalInterceptors = new HashSet<>(); | ||
Set<String> nonGlobalInterceptors = new HashSet<>(); | ||
|
||
Collection<ClassInfo> interceptorImplClasses = index.getAllKnownImplementors(interceptorInterface); | ||
for (ClassInfo interceptorImplClass : interceptorImplClasses) { | ||
if (Modifier.isAbstract(interceptorImplClass.flags()) | ||
|| Modifier.isInterface(interceptorImplClass.flags())) { | ||
continue; | ||
} | ||
if (interceptorImplClass.classAnnotation(GLOBAL_INTERCEPTOR) == null) { | ||
nonGlobalInterceptors.add(interceptorImplClass.name().toString()); | ||
} else { | ||
globalInterceptors.add(interceptorImplClass.name().toString()); | ||
} | ||
} | ||
return new GrpcInterceptors(globalInterceptors, nonGlobalInterceptors); | ||
} | ||
|
||
} |
Oops, something went wrong.