本文整理汇总了Java中com.intellij.psi.util.PropertyUtil.findPropertyField方法的典型用法代码示例。如果您正苦于以下问题:Java PropertyUtil.findPropertyField方法的具体用法?Java PropertyUtil.findPropertyField怎么用?Java PropertyUtil.findPropertyField使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.intellij.psi.util.PropertyUtil
的用法示例。
在下文中一共展示了PropertyUtil.findPropertyField方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: multiResolve
import com.intellij.psi.util.PropertyUtil; //导入方法依赖的package包/类
@NotNull
@Override
public ResolveResult[] multiResolve(boolean incompleteCode) {
final GrArgumentLabel context = getElement();
final GrNamedArgument namedArgument = (GrNamedArgument) context.getParent();
final GrExpression map = (GrExpression)namedArgument.getParent();
final PsiClassType classType = LiteralConstructorReference.getTargetConversionType(map);
if (classType != null) {
final PsiClass psiClass = classType.resolve();
if (psiClass != null) {
final GrExpression value = namedArgument.getExpression();
final List<ResolveResult> applicable = addMethodCandidates(classType, value);
final String memberName = getValue();
if (value == null || applicable.isEmpty()) {
final PsiMethod setter = PropertyUtil.findPropertySetter(psiClass, memberName, false, true);
if (setter != null) {
applicable.add(new PsiElementResolveResult(setter));
} else {
final PsiField field = PropertyUtil.findPropertyField(psiClass, memberName, false);
if (field != null) {
applicable.add(new PsiElementResolveResult(field));
}
}
}
return applicable.toArray(new ResolveResult[applicable.size()]);
}
}
return ResolveResult.EMPTY_ARRAY;
}
示例2: multiResolve
import com.intellij.psi.util.PropertyUtil; //导入方法依赖的package包/类
@NotNull
@Override
public ResolveResult[] multiResolve(boolean incompleteCode) {
final GrArgumentLabel context = getElement();
final GrNamedArgument namedArgument = (GrNamedArgument) context.getParent();
final GrExpression map = (GrExpression)namedArgument.getParent();
final PsiClassType classType = LiteralConstructorReference.getTargetConversionType(map);
if (classType != null) {
final PsiClass psiClass = classType.resolve();
if (psiClass != null) {
final GrExpression value = namedArgument.getExpression();
final List<ResolveResult> applicable = addMethodCandidates(classType, value);
final String memberName = getValue();
if ("super".equals(memberName) && GppTypeConverter.hasTypedContext(myElement)) {
final LiteralConstructorReference reference = (LiteralConstructorReference)map.getReference();
if (reference != null) {
return reference.multiResolve(incompleteCode);
}
}
if (value == null || applicable.isEmpty()) {
final PsiMethod setter = PropertyUtil.findPropertySetter(psiClass, memberName, false, true);
if (setter != null) {
applicable.add(new PsiElementResolveResult(setter));
} else {
final PsiField field = PropertyUtil.findPropertyField(psiClass.getProject(), psiClass, memberName, false);
if (field != null) {
applicable.add(new PsiElementResolveResult(field));
}
}
}
return applicable.toArray(new ResolveResult[applicable.size()]);
}
}
return ResolveResult.EMPTY_ARRAY;
}
示例3: findProperty
import com.intellij.psi.util.PropertyUtil; //导入方法依赖的package包/类
private PropertyDescriptor findProperty(PsiClass baseClass, String propertyName) {
PsiField field = PropertyUtil.findPropertyField(baseClass, propertyName, false);
PsiMethod getter = PropertyUtil.findPropertyGetter(baseClass, propertyName, false, true);
PsiMethod setter = PropertyUtil.findPropertySetter(baseClass, propertyName, false, true);
if (field != null
|| getter != null
|| setter != null) {
return new PropertyDescriptor(propertyName, field, getter, setter);
}
else {
return null;
}
}