Skip to content

Commit

Permalink
Hibernate Validator - Normalize ClientProxy for bean metadata retrieval
Browse files Browse the repository at this point in the history
  • Loading branch information
gsmet committed Jan 3, 2023
1 parent 4fa6890 commit b9969ef
Showing 1 changed file with 5 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,13 @@

import org.hibernate.validator.metadata.BeanMetaDataClassNormalizer;

import io.quarkus.arc.ClientProxy;
import io.quarkus.arc.Subclass;

/**
* In the case of a proxy generated by Arc, return the parent class.
* <br />
* This can have more than one level of hierarchy, in example:
* This can have more than one level of hierarchy, for example:
* <ul>
* <li>When using @{@link io.quarkus.test.junit.mockito.InjectMock} or @{@link io.quarkus.test.junit.mockito.InjectSpy}</li>
* </ul>
Expand All @@ -20,6 +21,9 @@ public <T> Class<? super T> normalize(Class<T> beanClass) {
while (Subclass.class.isAssignableFrom(targetClass)) {
targetClass = targetClass.getSuperclass();
}
while (ClientProxy.class.isAssignableFrom(targetClass)) {
targetClass = targetClass.getSuperclass();
}
return targetClass;
}

Expand Down

0 comments on commit b9969ef

Please sign in to comment.