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


Java DependencyUtils類代碼示例

本文整理匯總了Java中com.siyeh.ig.dependency.DependencyUtils的典型用法代碼示例。如果您正苦於以下問題:Java DependencyUtils類的具體用法?Java DependencyUtils怎麽用?Java DependencyUtils使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


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

示例1: getRelatedClasses

import com.siyeh.ig.dependency.DependencyUtils; //導入依賴的package包/類
private static Set<RefClass> getRelatedClasses(RefPackage aPackage,
                                               RefClass classToProcess) {
  final Set<RefClass> out = new HashSet<RefClass>();
  final Set<RefClass> dependencies =
    DependencyUtils.calculateDependenciesForClass(classToProcess);
  for (RefClass dependency : dependencies) {
    if (packageContainsClass(aPackage, dependency)) {
      out.add(dependency);
    }
  }

  final Set<RefClass> dependents =
    DependencyUtils.calculateDependentsForClass(classToProcess);
  for (RefClass dependent : dependents) {
    if (packageContainsClass(aPackage, dependent)) {
      out.add(dependent);
    }
  }
  return out;
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:21,代碼來源:DisjointPackageInspection.java

示例2: checkElement

import com.siyeh.ig.dependency.DependencyUtils; //導入依賴的package包/類
@Nullable
@Override
public CommonProblemDescriptor[] checkElement(
  @NotNull RefEntity refEntity,
  @NotNull AnalysisScope scope,
  @NotNull InspectionManager manager,
  @NotNull GlobalInspectionContext globalContext) {
  if (!(refEntity instanceof RefClass)) {
    return null;
  }
  final RefClass refClass = (RefClass)refEntity;
  final RefEntity owner = refClass.getOwner();
  if (!(owner instanceof RefPackage)) {
    return null;
  }

  final Set<RefClass> dependencies =
    DependencyUtils.calculateDependenciesForClass(refClass);
  for (RefClass dependency : dependencies) {
    if (inSameModule(refClass, dependency)) {
      return null;
    }
  }
  final Set<RefClass> dependents =
    DependencyUtils.calculateDependentsForClass(refClass);
  for (RefClass dependent : dependents) {
    if (inSameModule(refClass, dependent)) {
      return null;
    }
  }
  final PsiClass aClass = refClass.getElement();
  final PsiIdentifier identifier = aClass.getNameIdentifier();
  if (identifier == null) {
    return null;
  }
  return new CommonProblemDescriptor[]{
    manager.createProblemDescriptor(identifier,
                                    InspectionGadgetsBundle.message(
                                      "class.independent.of.module.problem.descriptor"),
                                    true, ProblemHighlightType.GENERIC_ERROR_OR_WARNING, false)
  };
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:43,代碼來源:ClassIndependentOfModuleInspection.java

示例3: checkElement

import com.siyeh.ig.dependency.DependencyUtils; //導入依賴的package包/類
@Override
@Nullable
public CommonProblemDescriptor[] checkElement(
  @NotNull RefEntity refEntity,
  @NotNull AnalysisScope analysisScope,
  @NotNull InspectionManager manager,
  @NotNull GlobalInspectionContext globalInspectionContext) {
  if (!(refEntity instanceof RefClass)) {
    return null;
  }
  final RefClass refClass = (RefClass)refEntity;
  final RefEntity owner = refClass.getOwner();
  if (!(owner instanceof RefPackage)) {
    return null;
  }

  final Set<RefClass> dependencies =
    DependencyUtils.calculateDependenciesForClass(refClass);
  for (RefClass dependency : dependencies) {
    if (inSamePackage(refClass, dependency)) {
      return null;
    }
  }
  final Set<RefClass> dependents =
    DependencyUtils.calculateDependentsForClass(refClass);
  for (RefClass dependent : dependents) {
    if (inSamePackage(refClass, dependent)) {
      return null;
    }
  }
  final PsiClass aClass = refClass.getElement();
  final PsiIdentifier identifier = aClass.getNameIdentifier();
  if (identifier == null) {
    return null;
  }
  return new CommonProblemDescriptor[]{
    manager.createProblemDescriptor(identifier,
                                    InspectionGadgetsBundle.message(
                                      "class.unconnected.to.package.problem.descriptor"),
                                    true, ProblemHighlightType.GENERIC_ERROR_OR_WARNING, false)
  };
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:43,代碼來源:ClassUnconnectedToPackageInspection.java

示例4: checkElement

import com.siyeh.ig.dependency.DependencyUtils; //導入依賴的package包/類
@Nullable
@Override
public CommonProblemDescriptor[] checkElement(
  RefEntity refEntity,
  AnalysisScope scope,
  InspectionManager manager,
  GlobalInspectionContext globalContext) {
  if (!(refEntity instanceof RefClass)) {
    return null;
  }
  final RefClass refClass = (RefClass)refEntity;
  final RefEntity owner = refClass.getOwner();
  if (!(owner instanceof RefPackage)) {
    return null;
  }

  final Set<RefClass> dependencies =
    DependencyUtils.calculateDependenciesForClass(refClass);
  for (RefClass dependency : dependencies) {
    if (inSameModule(refClass, dependency)) {
      return null;
    }
  }
  final Set<RefClass> dependents =
    DependencyUtils.calculateDependentsForClass(refClass);
  for (RefClass dependent : dependents) {
    if (inSameModule(refClass, dependent)) {
      return null;
    }
  }
  final PsiClass aClass = refClass.getElement();
  final PsiIdentifier identifier = aClass.getNameIdentifier();
  if (identifier == null) {
    return null;
  }
  return new CommonProblemDescriptor[]{
    manager.createProblemDescriptor(identifier,
                                    InspectionGadgetsBundle.message(
                                      "class.independent.of.module.problem.descriptor"),
                                    true, ProblemHighlightType.GENERIC_ERROR_OR_WARNING, false)
  };
}
 
開發者ID:consulo,項目名稱:consulo-java,代碼行數:43,代碼來源:ClassIndependentOfModuleInspection.java

示例5: checkElement

import com.siyeh.ig.dependency.DependencyUtils; //導入依賴的package包/類
@Override
@Nullable
public CommonProblemDescriptor[] checkElement(
  RefEntity refEntity,
  AnalysisScope analysisScope,
  InspectionManager manager,
  GlobalInspectionContext globalInspectionContext) {
  if (!(refEntity instanceof RefClass)) {
    return null;
  }
  final RefClass refClass = (RefClass)refEntity;
  final RefEntity owner = refClass.getOwner();
  if (!(owner instanceof RefPackage)) {
    return null;
  }

  final Set<RefClass> dependencies =
    DependencyUtils.calculateDependenciesForClass(refClass);
  for (RefClass dependency : dependencies) {
    if (inSamePackage(refClass, dependency)) {
      return null;
    }
  }
  final Set<RefClass> dependents =
    DependencyUtils.calculateDependentsForClass(refClass);
  for (RefClass dependent : dependents) {
    if (inSamePackage(refClass, dependent)) {
      return null;
    }
  }
  final PsiClass aClass = refClass.getElement();
  final PsiIdentifier identifier = aClass.getNameIdentifier();
  if (identifier == null) {
    return null;
  }
  return new CommonProblemDescriptor[]{
    manager.createProblemDescriptor(identifier,
                                    InspectionGadgetsBundle.message(
                                      "class.unconnected.to.package.problem.descriptor"),
                                    true, ProblemHighlightType.GENERIC_ERROR_OR_WARNING, false)
  };
}
 
開發者ID:consulo,項目名稱:consulo-java,代碼行數:43,代碼來源:ClassUnconnectedToPackageInspection.java


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