The problem is this comes in the realm of Design
Patterns, and Design Patterns aren't overly amenable to automated anything. Otherwise there'd be extortionately-priced software suites designed to exploit that. Instead what we have is mostly DIY, although the Iterator pattern is now built into
Java itself.
There are some things that can help. A product that can scan for questionable usages whose exact name escapes me (it's something like BugBuddy). I think it is supported by a Maven plugin, but it's also something that can plug into an
IDE.
Likewise, some of the UML tools try to help. I know that the open-source ArgoUML tool does. But that's all interactive critiquing, not batch-mode, so it's hard to make Maven work with it.
The secret of how to be miserable is to constantly expect things are going to happen the way that they are "supposed" to happen.
You can have faith, which carries the understanding that you may be disappointed. Then there's being a willfully-blind idiot, which virtually guarantees it.