Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.
Sometimes you’ll have two views that can be mediated in the same way. Perhaps one of the views extends the other. A common example is the case of a nested menu where sections and subsections might have a different appearance and internal behavior, but behave the same in terms of how they relate to the application. Where the user is rolling over or clicking a section or subsection, you want the mediator to send an event informing the application that something has been rolled over or selected, so you want to map both view types against a single mediator type.
The catch is that your mediator expects a view to be injected
against an exact type. If the mediator expects SectionButton to be injected, when the
mediator for SubSectionButton is created, it will
complain about a ‘null injection error’. This is because the mediatorMap
automatically injects the view against its Fully Qualified Class Name, and doesn’t
automatically inject against all its superTypes and interfaces. The work
around is to specify extra classes that you would like the view to be
mapped against: