use of org.jetbrains.plugins.groovy.lang.resolve.processors.AccessorResolverProcessor in project intellij-community by JetBrains.
the class GroovyPropertyUtils method findPropertySetter.
@Nullable
public static PsiMethod findPropertySetter(@Nullable PsiType type, String propertyName, @NotNull GroovyPsiElement context) {
final String setterName = getSetterName(propertyName);
if (type == null) {
final GrExpression fromText = GroovyPsiElementFactory.getInstance(context.getProject()).createExpressionFromText("this", context);
return findPropertySetter(fromText.getType(), propertyName, context);
}
final AccessorResolverProcessor processor = new AccessorResolverProcessor(setterName, propertyName, context, false);
ResolveUtil.processAllDeclarations(type, processor, ResolveState.initial(), context);
final GroovyResolveResult[] setterCandidates = processor.getCandidates();
return PsiImplUtil.extractUniqueElement(setterCandidates);
}
Aggregations