Futurescale, Inc. PureMVC Home

The PureMVC Framework Code at the Speed of Thought


Welcome, Guest. Please login or register.
September 22, 2017, 08:49:42 PM
Home Help Search Login Register
News: Please DM @puremvc on Twitter to gain forum access. Spambots are why we can't have nice things.
Pages: [1]
Print
Author Topic: overload in facade and Notification class  (Read 5278 times)
Gallo_Teo
Newbie
*
Posts: 8


View Profile
« on: January 04, 2009, 07:39:47 AM »

In java you can't use default parameter so i think it's better to overload some pureMVC methods

in Notification class

Code:
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

Code:

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


Logged
puremvc
Global Moderator
Hero Member
*****
Posts: 2871



View Profile WWW
« Reply #1 on: January 04, 2009, 12:05:05 PM »

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>
Logged
Pages: [1]
Print
Jump to: