当前位置: 首页>>代码示例>>Java>>正文


Java PropertyUtil.findPropertyField方法代码示例

本文整理汇总了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;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:34,代码来源:GppReferenceContributor.java

示例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;
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:41,代码来源:GppReferenceContributor.java

示例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;
  }
}
 
开发者ID:hypoport,项目名称:idea-dozer-plugin,代码行数:14,代码来源:FieldExpression.java


注:本文中的com.intellij.psi.util.PropertyUtil.findPropertyField方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。