Yes,
the idiom of using:
- an interface to name a role within the
pattern
- having an aspect define advice and introductions on the
interface
- and using declare parents in other aspects to say what classes
play the role in concrete patterns
is
the way to go here.
One
additional suggestion is to make the interface, i.e. Singleton, a protected
inner interface of the
pattern, i.e. SingletonAspect. That often makes code like this
look better, because it makes it clear
that
the interface really only has meaning withing the aspect (or extensions of the
aspect).