PsiClassType psiClassType = (PsiClassType) psiFieldType;
Project project = psiElement.getProject();
JavaPsiFacade javaPsiFacade = JavaPsiFacade.getInstance(project);
GlobalSearchScope globalSearchScope = GlobalSearchScope.allScope(project);
PsiClass lazyClass = javaPsiFacade.findClass(CLASS_LAZY, globalSearchScope);
PsiClass providerClass = javaPsiFacade.findClass(CLASS_PROVIDER, globalSearchScope);
PsiClassType.ClassResolveResult classResolveResult = psiClassType.resolveGenerics();
PsiClass outerClass = classResolveResult.getElement();
// If Lazy<Foo> or Provider<Foo>, extract Foo as the interesting type.
if (outerClass != null //
&& (outerClass.equals(lazyClass) || outerClass.equals(providerClass))) {
PsiType genericType =
classResolveResult.getSubstitutor().getSubstitutionMap().values().iterator().next();
// Convert genericType to its PsiClass and store in psiClass
wrapperClass = getClass(genericType);
}