Futurescale, Inc. PureMVC Home

The PureMVC Framework Code at the Speed of Thought


Over 10 years of community discussion and knowledge are maintained here as a read-only archive.

New discussions should be taken up in issues on the appropriate projects at https://github.com/PureMVC

Pages: [1]
Print
Author Topic: overload in facade and Notification class  (Read 8705 times)
Gallo_Teo
Newbie
*
Posts: 8


View Profile Email
« 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


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



View Profile WWW Email
« Reply #1 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>
Logged
Pages: [1]
Print