tag:robotlegs.tenderapp.com,2009-10-18:/discussions/robotlegs-2/3533-mediator-inheritance-in-rl2Robotlegs: Discussion 2013-06-29T12:38:05Ztag:robotlegs.tenderapp.com,2009-10-18:Comment/274864052013-06-25T18:17:18Z2013-06-25T18:17:18ZMediator inheritance in RL2<div><p>I'm wondering about the current best practices for mediator
inheritance in RL2. I found an old support thread from 2010
discussing the solution that was implemented in RL1 (<a href=
"http://knowledge.robotlegs.org/discussions/problems/165-mediators-and-inheritance-maximizing-code-reuse-minimizing-hacky-casting">http://knowledge.robotlegs.org/discussions/problems/165-mediators-a...</a>)
which involves passing through an array of potentially viable
object types when mapping the view to the mediator:</p>
<p>Ex: mediatorMap.mapView(FancyPhoto, PhotoanalystMuseumCurator,
[FancyPhoto, Artwork]);</p>
<p>I'm just wondering if this technique has carried over to RL2 or
if a new method has been implemented for handling this case?</p>
<p>Side Note: REALLY loving the new config, install workflow in
RL2!</p></div>Kyletag:robotlegs.tenderapp.com,2009-10-18:Comment/274864052013-06-27T08:54:45Z2013-06-27T08:54:45ZMediator inheritance in RL2<div><p>Hi Kyle,</p>
<p>This only existed in RL1 as a kind of work-around because RL1
could only map to concrete types. RL2 maps to interfaces and
abstract types, so this isn't needed any more.</p>
<p>If you want something more tailored you can use matchers to
create more specific mediator mappings. Something like this:</p>
<pre>
<code>mediatorMap.mapMatcher(new TypeMatcher().anyOf(ISpaceShip, IRocket)).toMediator(SpaceCraftMediator);</code>
</pre>
<p><a href=
"https://github.com/robotlegs/robotlegs-framework/tree/master/src/robotlegs/bender/extensions/mediatorMap">
https://github.com/robotlegs/robotlegs-framework/tree/master/src/ro...</a></p></div>Shaun Smithtag:robotlegs.tenderapp.com,2009-10-18:Comment/274864052013-06-27T18:44:26Z2013-06-27T18:44:26ZMediator inheritance in RL2<div><p>Sweet, thanks Sean!</p></div>Kyletag:robotlegs.tenderapp.com,2009-10-18:Comment/274864052013-06-29T12:38:04Z2013-06-29T12:38:04ZMediator inheritance in RL2<div><p>No problemo! Closing this thread for now. Feel free to re-open,
or start a new one.</p></div>Shaun Smith