Ejemplo n.º 1
0
  @NotNull
  public static Collection<JavaClass> getClassesInPackage(@NotNull JavaPackage javaPackage) {
    Collection<JavaClass> classes = javaPackage.getClasses();
    Set<FqName> addedQualifiedNames = new HashSet<FqName>(classes.size());
    List<JavaClass> result = new ArrayList<JavaClass>(classes.size());

    for (JavaClass javaClass : classes) {
      FqName fqName = javaClass.getFqName();
      if (fqName != null && addedQualifiedNames.add(fqName)) {
        result.add(javaClass);
      }
    }

    return result;
  }
Ejemplo n.º 2
0
  @Nullable
  public static ValueParameterDescriptor getAnnotationParameterByName(
      @NotNull Name name, @NotNull ClassDescriptor annotationClass) {
    Collection<ConstructorDescriptor> constructors = annotationClass.getConstructors();
    assert constructors.size() == 1 : "Annotation class descriptor must have only one constructor";

    for (ValueParameterDescriptor parameter : constructors.iterator().next().getValueParameters()) {
      if (parameter.getName().equals(name)) {
        return parameter;
      }
    }

    return null;
  }