-
Notifications
You must be signed in to change notification settings - Fork 77
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Cleanup Types interface / add Type.ofClass(String) #513
Conversation
Implementing Also, is And finally, while I'm not against adding |
Ah and one nit: I started using I can rewrite it in a later PR myself, so no need to worry about that. |
Ok if it has to be binary name I guess we will need to deal with it though these are slightly awkward for arrays In terms of why it is necessary you may want to enhance based on the presence of a type on the user classpath and not on the extension classpath (psuedo code): @Enhancement
@ExactType(type = FaultToleranceInterceptor.class)
void addMetrics(ClassConfig<?> clazz, Types types) {
if (types.forName("some.metrics.MetricsBackend") != null) {
clazz.addAnnotation(AnnotationBuilder.of(SomeAnnotation.class).member("metricsEnabled", true).build());
}
} |
Ah I see. Maybe it would be best to limit this kind of thing to classes, because you can create array types easily? Or even better, maybe we could have an API to find a |
An API for creating |
We could generalize the existing service provider interface to support this as well, no need to create a second one. |
Good idea 👍 |
@Ladicek I started looking at adding a |
Ah I think I'd prefer the latter -- just to keep the language model potentially easily reusable and/or implementable by everyone else. Now, where would it go... Maybe you were right the first time, maybe we should add this to Sorry for the noise I cause -- I'm investigating a performance issue in parallel to this work, so I have to context switch a bit and it shows. |
@Ladicek how about this? I am not sure we can make |
We have |
OK marking this as ready for review, I left the changes to switch to |
My take is that I'd prefer to have as little of implementation code as possible in the spec API. Whatever can be left to implementers, should be -- including the lookup of extension instances. |
This cleans up the
Types
interface and also addsforName
method to resolve a type by the canonical name if possible. Not sure how doable that is in Quarkus, but we need some way to create types by name.