Skip to content

Commit

Permalink
WIP static resolution of FT methods (@fallback, @BeforeRetry)
Browse files Browse the repository at this point in the history
  • Loading branch information
Ladicek committed Sep 6, 2024
1 parent 441c98d commit 93da343
Show file tree
Hide file tree
Showing 5 changed files with 580 additions and 59 deletions.
2 changes: 1 addition & 1 deletion bom/application/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@
<smallrye-metrics.version>4.0.0</smallrye-metrics.version>
<smallrye-open-api.version>3.10.0</smallrye-open-api.version>
<smallrye-graphql.version>2.9.2</smallrye-graphql.version>
<smallrye-fault-tolerance.version>6.4.0</smallrye-fault-tolerance.version>
<smallrye-fault-tolerance.version>6.4.1-SNAPSHOT</smallrye-fault-tolerance.version>
<smallrye-jwt.version>4.6.0</smallrye-jwt.version>
<smallrye-context-propagation.version>2.1.2</smallrye-context-propagation.version>
<smallrye-reactive-streams-operators.version>1.0.13</smallrye-reactive-streams-operators.version>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -186,21 +186,33 @@ public A build(ClassOutput classOutput) {
new InvocationHandler() {
@Override
public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
switch (method.getName()) {
case "getAnnotationLiteralType":
return annotationLiteral;
case "getAnnotationClass":
return annotationClass;
case "getAnnotationInstance":
return annotationInstance;
case "getDefaultValues":
return defaultValues;
case "getValues":
return values;
default:
break;
}
throw new UnsupportedOperationException("Method " + method + " not implemented");
String name = method.getName();
return switch (name) {
case "getAnnotationLiteralType" -> annotationLiteral;
case "getAnnotationClass" -> annotationClass;
case "getAnnotationInstance" -> annotationInstance;
case "getDefaultValues" -> defaultValues;
case "getValues" -> values;
default -> {
MethodInfo member = annotationClass.firstMethod(name);
if (member != null) {
if (values.containsKey(name)) {
yield values.get(name);
}
if (annotationInstance.value(name) != null) {
yield annotationInstance.value(name).value();
}
if (defaultValues.containsKey(name)) {
yield defaultValues.get(name);
}
if (member.defaultValue() != null) {
yield member.defaultValue().value();
}
throw new UnsupportedOperationException("Unknown value of annotation member " + name);
}
throw new UnsupportedOperationException("Method " + method + " not implemented");
}
};
}
});
}
Expand Down
Loading

0 comments on commit 93da343

Please sign in to comment.