Skip to content

slices() architecture should take a DescribedPredicate<JavaClass> #1536

@xenoterracide

Description

@xenoterracide

I slice and layer to get module boundaries.

The pain I'm experiencing is that a slices() has matching(String) but for layers I can pass a DescribedPredicate this is resulting in code duplication, and exposing strings.

this is also related to #1534 in that I want to use some of the same predicates or sub predicates, as the layer predicates are often using and( and or( from what I would use for slices

slices().that(resideInAPackage("domain.aggregate.(*)"))
static class Domain {

   static DescribedPredicate<JavaClass> AGGREGATE = residesInAPackage("domain.aggregate.(*)")
   static DescribedPredicate<JavaClass> SERVICE = residesInAPackage("domain.service")

   static Layer layer() {
     return new Layer("Domain", or(AGGREGATE, SERVICE);
   }
}

slices()
   .that(Domain.AGGREGATE) // note: layer is a value object and thus any instance with the same 
value...
   .should()
   .notDependOnEachOther()

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