Mediator inheritance in RL2

Kyle's Avatar

Kyle

25 Jun, 2013 06:17 PM

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 (http://knowledge.robotlegs.org/discussions/problems/165-mediators-and-inheritance-maximizing-code-reuse-minimizing-hacky-casting) which involves passing through an array of potentially viable object types when mapping the view to the mediator:

Ex: mediatorMap.mapView(FancyPhoto, PhotoanalystMuseumCurator, [FancyPhoto, Artwork]);

I'm just wondering if this technique has carried over to RL2 or if a new method has been implemented for handling this case?

Side Note: REALLY loving the new config, install workflow in RL2!

  1. Support Staff 1 Posted by Shaun Smith on 27 Jun, 2013 08:54 AM

    Shaun Smith's Avatar

    Hi Kyle,

    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.

    If you want something more tailored you can use matchers to create more specific mediator mappings. Something like this:

    mediatorMap.mapMatcher(new TypeMatcher().anyOf(ISpaceShip, IRocket)).toMediator(SpaceCraftMediator);
    

    https://github.com/robotlegs/robotlegs-framework/tree/master/src/ro...

  2. 2 Posted by Kyle on 27 Jun, 2013 06:44 PM

    Kyle's Avatar

    Sweet, thanks Sean!

  3. Support Staff 3 Posted by Shaun Smith on 29 Jun, 2013 12:38 PM

    Shaun Smith's Avatar

    No problemo! Closing this thread for now. Feel free to re-open, or start a new one.

  4. Shaun Smith closed this discussion on 29 Jun, 2013 12:38 PM.

Comments are currently closed for this discussion. You can start a new one.

Keyboard shortcuts

Generic

? Show this help
ESC Blurs the current field

Comment Form

r Focus the comment reply box
^ + ↩ Submit the comment

You can use Command ⌘ instead of Control ^ on Mac