Skip to content

Rule for nesting of packages #79

Open
@obecker

Description

@obecker

Is there a way to express that classes of a more general package must not access classes of more specialized (or sub) packages?

Rationale: based on an hexagonal architecture style I have my domain classes for example in
com.enterprise.business.domain
The corresponding repository interface is
com.enterprise.business.domain.repo
The specific mongodb implementation could be in
com.enterprise.business.domain.repo.mongodb
etc

So classes in an outer (e.g. com.enterprise.business.domain.repo.mongodb) package can access classes in the base com.enterprise.business.domain package, but never the other way around.
I would like to express this restriction in a general manner.
Something like: a class in some package X must not access a class in some package Y where X is a package prefix of Y.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions