protected static void validateResourceInjectionPointType(ManagedReferenceFactory fact, InjectionPoint injectionPoint) {
if (!(fact instanceof ContextListManagedReferenceFactory) || injectionPoint == null) {
return; // validation is skipped as we have no information about the resource type
}
final ContextListManagedReferenceFactory factory = (ContextListManagedReferenceFactory) fact;
// the resource class may come from JBoss AS
Class<?> resourceClass = org.jboss.as.weld.util.Reflections.loadClass(factory.getInstanceClassName(), factory.getClass().getClassLoader());
// or it may come from deployment
if (resourceClass == null) {
resourceClass = org.jboss.as.weld.util.Reflections.loadClass(factory.getInstanceClassName(), WildFlySecurityManager.getCurrentContextClassLoaderPrivileged());
}
if (resourceClass != null) {
validateResourceInjectionPointType(resourceClass, injectionPoint);
}