-
Notifications
You must be signed in to change notification settings - Fork 33
Description
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.