Skip to content

Feature: Flexible Filtering for ApplicationModules #1515

@xenoterracide

Description

@xenoterracide

Problem

ApplicationModules.of(…) factory methods are restrictive. Specifically:

  • Naming Collisions: A DescribedPredicate sharing a name with the class blocks the import.
  • Lack of Composition: Cannot apply multiple ImportOption filters (e.g., excluding tests AND fixtures) while using predicates.

Proposed Solution

Introduce a Builder or expanded Varargs support to match ArchUnit’s ClassFileImporter flexibility:

// Option A: Builder Pattern
ApplicationModules modules = ApplicationModules.builder(MyApplication.class)
    .withImportOption(ImportOption.Predefined.DO_NOT_INCLUDE_TESTS)
    .withExclusion(DescribedPredicate.resideInAPackage("..internal.."))
    .build();

// Option B: Importer Injection
ClassFileImporter importer = new ClassFileImporter()
    .withImportOption(new DontIncludeTests());
ApplicationModules modules = ApplicationModules.of(MyApplication.class, importer);

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions