PureMVC Architects Lounge

PureMVC Manifold => Standard Version => Topic started by: Gallo_Teo on January 04, 2009, 07:39:47



Title: overload in facade and Notification class
Post by: Gallo_Teo on January 04, 2009, 07:39:47
In java you can't use default parameter so i think it's better to overload some pureMVC methods

in Notification class

:
public Notification( String name, Object body, String type )
{
this.name = name;
this.body = body;
this.type = type;
}

public Notification(String notificationName, Object object) {
this(notificationName, object, null);
}

public Notification(String notificationName) {
this(notificationName, null);
}


in facade classe

:

public void sendNotification( String notificationName, Object body )
{
notifyObservers( new Notification( notificationName, body, null ) );
}


public void sendNotification( String notificationName )
{
notifyObservers( new Notification( notificationName, null ) );
}

so it is quite more usable


i still have problems undestanding how to link views and mediators in java because i can't use bubbled events so a lot fo boring code is required

i'm studing a better way to handle notifications in mediator because we can't use String with switch statement, probably the best way is tu use enumeration but we can't extend it later so i don't know if it is a good solution, what do you think about ?

Teo




Title: Re: overload in facade and Notification class
Post by: puremvc on January 04, 2009, 12:05:05
You're spot on about the overloaded methods.

As for enums for notification names, let me know what your musings lead you to. Also check the multicore port to see if anything is handled differently. This is the one port where multicore and standard have separate owners and we need to reconcile the code a bit to make sure that they stay in sync with these issues.

Thanks,
-=Cliff>