/** * Find the packages we depend on, where we implement an interface that is a * Provider Type. These packages, when we import them, must use the provider * policy. * * @throws Exception */ Set<PackageRef> findProvidedPackages() throws Exception { Set<PackageRef> providers = classspace.values() .stream() .flatMap(c -> { // filter out interfaces in the same package as the class // implementing the // interface. PackageRef pkg = c.getClassName() .getPackageRef(); return c.interfaces() .stream() .filter(i -> !Objects.equals(pkg, i.getPackageRef())); }) .distinct() .filter(this::isProvider) .map(TypeRef::getPackageRef) .collect(Collectors.toCollection(LinkedHashSet::new)); return providers; }
/** * Find the packages we depend on, where we implement an interface that is a * Provider Type. These packages, when we import them, must use the provider * policy. * * @throws Exception */ Set<PackageRef> findProvidedPackages() throws Exception { Set<PackageRef> providers = classspace.values() .stream() .flatMap(c -> { // filter out interfaces in the same package as the class // implementing the // interface. PackageRef pkg = c.getClassName() .getPackageRef(); return c.interfaces() .stream() .filter(i -> !Objects.equals(pkg, i.getPackageRef())); }) .distinct() .filter(this::isProvider) .map(TypeRef::getPackageRef) .collect(Collectors.toCollection(LinkedHashSet::new)); return providers; }