當前位置: 首頁>>代碼示例>>Java>>正文


Java PsiMethod.getNameIdentifier方法代碼示例

本文整理匯總了Java中com.intellij.psi.PsiMethod.getNameIdentifier方法的典型用法代碼示例。如果您正苦於以下問題:Java PsiMethod.getNameIdentifier方法的具體用法?Java PsiMethod.getNameIdentifier怎麽用?Java PsiMethod.getNameIdentifier使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在com.intellij.psi.PsiMethod的用法示例。


在下文中一共展示了PsiMethod.getNameIdentifier方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: visitMethod

import com.intellij.psi.PsiMethod; //導入方法依賴的package包/類
@Override
public void visitMethod(PsiMethod method) {
  super.visitMethod(method);
  if (!TestNGUtil.hasTest(method)) {
    return;
  }
  final PsiIdentifier nameIdentifier = method.getNameIdentifier();
  if (nameIdentifier == null) {
    return;
  }
  final String name = method.getName();
  if (isValid(name)) {
    return;
  }
  if (!isOnTheFly() && MethodUtils.hasSuper(method)) {
    return;
  }
  if (LibraryUtil.isOverrideOfLibraryMethod(method)) {
    return;
  }
  registerMethodError(method, name);
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:23,代碼來源:TestNGMethodNamingConventionInspection.java

示例2: visitMethod

import com.intellij.psi.PsiMethod; //導入方法依賴的package包/類
@Override
public void visitMethod(PsiMethod method) {
  super.visitMethod(method);
  if (!TestUtils.isJUnit4TestMethod(method) || !TestUtils.isRunnable(method)) {
    return;
  }
  final PsiIdentifier nameIdentifier = method.getNameIdentifier();
  if (nameIdentifier == null) {
    return;
  }
  final String name = method.getName();
  if (isValid(name)) {
    return;
  }
  if (!isOnTheFly() && MethodUtils.hasSuper(method)) {
    return;
  }
  if (LibraryUtil.isOverrideOfLibraryMethod(method)) {
    return;
  }
  registerMethodError(method, name);
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:23,代碼來源:JUnit4MethodNamingConventionInspectionBase.java

示例3: visitMethod

import com.intellij.psi.PsiMethod; //導入方法依賴的package包/類
@Override
public void visitMethod(PsiMethod method) {
  super.visitMethod(method);
  if (!TestUtils.isJUnit3TestMethod(method) || !TestUtils.isRunnable(method)) {
    return;
  }
  final PsiIdentifier nameIdentifier = method.getNameIdentifier();
  if (nameIdentifier == null) {
    return;
  }
  final String name = method.getName();
  if (isValid(name)) {
    return;
  }
  if (!isOnTheFly() && MethodUtils.hasSuper(method)) {
    return;
  }
  if (LibraryUtil.isOverrideOfLibraryMethod(method)) {
    return;
  }
  registerMethodError(method, name);
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:23,代碼來源:JUnit3MethodNamingConventionInspectionBase.java

示例4: visitMethod

import com.intellij.psi.PsiMethod; //導入方法依賴的package包/類
@Override
public void visitMethod(@NotNull PsiMethod method) {
  super.visitMethod(method);
  if (method.isConstructor()) {
    return;
  }
  if (!method.hasModifierProperty(PsiModifier.NATIVE)) {
    return;
  }
  final PsiIdentifier nameIdentifier = method.getNameIdentifier();
  if (nameIdentifier == null) {
    return;
  }
  final String name = method.getName();
  if (isValid(name)) {
    return;
  }
  if (!isOnTheFly() && MethodUtils.hasSuper(method)) {
    return;
  }
  if (LibraryUtil.isOverrideOfLibraryMethod(method)) {
    return;
  }
  registerMethodError(method, name);
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:26,代碼來源:NativeMethodNamingConventionInspectionBase.java

示例5: visitMethod

import com.intellij.psi.PsiMethod; //導入方法依賴的package包/類
@Override
public void visitMethod(@NotNull PsiMethod method) {
  //no call to super, so we don't drill into anonymous classes
  if (method.isConstructor()) {
    return;
  }
  if (method.hasModifierProperty(PsiModifier.SYNCHRONIZED)) {
    return;
  }
  if (method.getNameIdentifier() == null) {
    return;
  }
  final PsiMethod[] superMethods = method.findSuperMethods();
  for (final PsiMethod superMethod : superMethods) {
    if (superMethod.hasModifierProperty(PsiModifier.SYNCHRONIZED)) {
      registerMethodError(method);
      return;
    }
  }
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:21,代碼來源:NonSynchronizedMethodOverridesSynchronizedMethodVisitor.java

示例6: visitMethod

import com.intellij.psi.PsiMethod; //導入方法依賴的package包/類
@Override
public void visitMethod(@NotNull PsiMethod method) {
  // note: no call to super
  if (method.getNameIdentifier() == null) {
    return;
  }
  if (!method.isConstructor()) {
    return;
  }
  if (ignoreScope != Scope.NONE) {
    switch (ignoreScope.ordinal()) {
      case 3: if (method.hasModifierProperty(PsiModifier.PROTECTED)) return;
      case 2: if (method.hasModifierProperty(PsiModifier.PACKAGE_LOCAL)) return;
      case 1: if (method.hasModifierProperty(PsiModifier.PRIVATE)) return;
    }
  }
  final PsiParameterList parameterList = method.getParameterList();
  final int parametersCount = parameterList.getParametersCount();
  if (parametersCount <= getLimit()) {
    return;
  }
  registerMethodError(method, Integer.valueOf(parametersCount));
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:24,代碼來源:ParametersPerConstructorInspectionBase.java

示例7: visitMethod

import com.intellij.psi.PsiMethod; //導入方法依賴的package包/類
@Override
public void visitMethod(@NotNull PsiMethod method) {
  // note: no call to super
  if (method.getNameIdentifier() == null) {
    return;
  }
  if (method.isConstructor()) {
    return;
  }
  final PsiParameterList parameterList = method.getParameterList();
  final int parametersCount = parameterList.getParametersCount();
  if (parametersCount <= getLimit()) {
    return;
  }
  if (LibraryUtil.isOverrideOfLibraryMethod(method)) {
    return;
  }
  registerMethodError(method, Integer.valueOf(parametersCount));
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:20,代碼來源:ParametersPerMethodInspection.java

示例8: visitMethod

import com.intellij.psi.PsiMethod; //導入方法依賴的package包/類
@Override
public void visitMethod(@NotNull PsiMethod method) {
  // note: no call to super
  if (method.getNameIdentifier() == null) {
    return;
  }
  if (ignoreEqualsMethod) {
    if (MethodUtils.isEquals(method)) {
      return;
    }
  }
  final int returnPointCount = calculateReturnPointCount(method);
  if (returnPointCount <= getLimit()) {
    return;
  }
  registerMethodError(method, Integer.valueOf(returnPointCount));
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:18,代碼來源:MultipleReturnPointsPerMethodInspection.java

示例9: visitMethod

import com.intellij.psi.PsiMethod; //導入方法依賴的package包/類
@Override
public void visitMethod(@NotNull PsiMethod method) {
  // note: no call to super
  if (method.getNameIdentifier() == null) {
    return;
  }
  final CouplingVisitor visitor = new CouplingVisitor(
    method, m_includeJavaClasses, m_includeLibraryClasses);
  method.accept(visitor);
  final int coupling = visitor.getNumDependencies();

  if (coupling <= getLimit()) {
    return;
  }
  registerMethodError(method, Integer.valueOf(coupling));
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:17,代碼來源:MethodCouplingInspection.java

示例10: visitMethod

import com.intellij.psi.PsiMethod; //導入方法依賴的package包/類
@Override
public void visitMethod(@NotNull PsiMethod method) {
  // note: no call to super
  if (method.getNameIdentifier() == null) {
    return;
  }
  final NegationCountVisitor visitor = new NegationCountVisitor(ignoreInAssert);
  method.accept(visitor);
  final int negationCount = visitor.getCount();
  if (negationCount <= 3) {
    return;
  }
  if (m_ignoreInEquals && MethodUtils.isEquals(method)) {
    return;
  }
  registerMethodError(method, Integer.valueOf(negationCount));
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:18,代碼來源:ThreeNegationsPerMethodInspection.java

示例11: getMethodStartLineNumber

import com.intellij.psi.PsiMethod; //導入方法依賴的package包/類
private static int getMethodStartLineNumber(@NotNull PsiMethod method, @NotNull Document document) {
    if (method.getNameIdentifier() == null)
        return -1;

    int offset = method.getNameIdentifier().getTextOffset();
    return document.getLineNumber(offset);
}
 
開發者ID:Tuxilero,項目名稱:LineCounter-Plugin,代碼行數:8,代碼來源:UIManager.java

示例12: visitMethod

import com.intellij.psi.PsiMethod; //導入方法依賴的package包/類
@Override
public void visitMethod(@NotNull PsiMethod method) {
  // note: no call to super
  if (method.getNameIdentifier() == null) {
    return;
  }
  final NestingDepthVisitor visitor = new NestingDepthVisitor(getLimit());
  method.accept(visitor);
  final int count = visitor.getMaximumDepth();
  if (count <= getLimit()) {
    return;
  }
  registerMethodError(method, Integer.valueOf(count));
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:15,代碼來源:NestingDepthInspection.java

示例13: visitMethod

import com.intellij.psi.PsiMethod; //導入方法依賴的package包/類
@Override
public void visitMethod(@NotNull PsiMethod method) {
  final PsiClass aClass = method.getContainingClass();
  if (aClass == null) {
    return;
  }
  if (method.getNameIdentifier() == null) {
    return;
  }
  final String methodName = method.getName();
  final MethodSignature signature = method.getSignature(PsiSubstitutor.EMPTY);
  PsiClass ancestorClass = aClass.getSuperClass();
  final Set<PsiClass> visitedClasses = new HashSet<PsiClass>();
  while (ancestorClass != null) {
    if (!visitedClasses.add(ancestorClass)) {
      return;
    }
    final PsiMethod[] methods =
      ancestorClass.findMethodsByName(methodName, false);
    for (final PsiMethod testMethod : methods) {
      final MethodSignature testSignature = testMethod.getSignature(PsiSubstitutor.EMPTY);
      if (!signature.equals(testSignature)) {
        continue;
      }
      if (testMethod.hasModifierProperty(PsiModifier.STATIC) &&
          !testMethod.hasModifierProperty(PsiModifier.PRIVATE)) {
        registerMethodError(method);
        return;
      }
    }
    ancestorClass = ancestorClass.getSuperClass();
  }
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:34,代碼來源:MethodOverridesStaticMethodInspectionBase.java

示例14: visitMethod

import com.intellij.psi.PsiMethod; //導入方法依賴的package包/類
@Override
public void visitMethod(@NotNull PsiMethod method) {
  // no call to super, so it doesn't drill down into inner classes
  if (method.isConstructor()) {
    return;
  }
  if (method.getNameIdentifier() == null) {
    return;
  }
  final PsiClass containingClass = method.getContainingClass();
  if (containingClass == null) {
    return;
  }
  final PsiClass parent = containingClass.getSuperClass();
  if (parent == null) {
    return;
  }
  final String parentName = parent.getName();
  if (parentName == null) {
    return;
  }
  final String methodName = method.getName();
  if (!methodName.equals(parentName)) {
    return;
  }
  registerMethodError(method);
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:28,代碼來源:MethodNameSameAsParentNameInspectionBase.java

示例15: visitMethod

import com.intellij.psi.PsiMethod; //導入方法依賴的package包/類
@Override
public void visitMethod(@NotNull PsiMethod method) {
  super.visitMethod(method);
  if (method.isConstructor() || method.hasModifierProperty(PsiModifier.STATIC)) {
    return;
  }
  if (method.hasModifierProperty(PsiModifier.NATIVE) && isInspectionEnabled("NativeMethodNamingConvention", method)) {
    return;
  }
  final PsiIdentifier nameIdentifier = method.getNameIdentifier();
  if (nameIdentifier == null) {
    return;
  }
  if (TestUtils.isRunnable(method)) {
    if (TestUtils.isJUnit4TestMethod(method) && isInspectionEnabled("JUnit4MethodNamingConvention", method)) {
      return;
    }
    if (TestUtils.isJUnit3TestMethod(method) && isInspectionEnabled("JUnit3MethodNamingConvention", method)) {
      return;
    }
  }
  if (isTestNGTestMethod(method) && isInspectionEnabled("TestNGMethodNamingConvention", method)) {
    return;
  }
  final String name = method.getName();
  if (isValid(name)) {
    return;
  }
  if (!isOnTheFly() && MethodUtils.hasSuper(method)) {
    return;
  }
  if (LibraryUtil.isOverrideOfLibraryMethod(method)) {
    return;
  }
  registerMethodError(method, name);
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:37,代碼來源:InstanceMethodNamingConventionInspectionBase.java


注:本文中的com.intellij.psi.PsiMethod.getNameIdentifier方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。