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: Need for getProxyName method  (Read 12080 times)
jimrobson
Courseware Beta
Newbie
***
Posts: 7


View Profile Email
« on: January 15, 2008, 06:15:08 »

What is the purpose of the getProxyName method? Admittedly, I'm still a PureMVC n00b, but at this point I don't envision using this method very often. What would be the consequences if I were to write my proxy classes without implementing IProxy - and thereby omitting this method? I would like to write proxy classes that extend Notifier but do not implement IProxy. Would this be wrong, and if so, why?
Logged
Rhysyngsun
Courseware Beta
Sr. Member
***
Posts: 51

Nathan Levesque

 - rhysyngsun@gmail.com  - rhysyngsun
View Profile WWW Email
« Reply #1 on: January 15, 2008, 06:58:03 »

getProxyName is used internally in the view in the registerProxy method to get the name of the proxy, however, this functionality is defined in org.puremvc.patterns.proxy.Proxy. Take a look there and as long as you pass the proxy's name to the base class's constructor. The only time you would really need to use getProxyName is if you were implementing your own custom implementation of the Proxy class or aren't passing the proxy's name to the base class constructor.
Logged

jimrobson
Courseware Beta
Newbie
***
Posts: 7


View Profile Email
« Reply #2 on: January 15, 2008, 08:06:07 »

@Rhysingsun - Thanks for the reply.

I looked in    org.puremvc.core.view.View, and I don't see a registerProxy method.

Your answer seems to presuppose that I plan to extend Proxy, but I don't. What I'm suggesting is that I would like to bypass IProxy altogether (Proxy implements IProxy).
Logged
puremvc
Global Moderator
Hero Member
*****
Posts: 2871



View Profile WWW Email
« Reply #3 on: January 15, 2008, 08:09:27 »

That's the Model calling the method not the View. But just the same, its used internally to find out the name of the Proxy instance at registration time.

The reason its needed (as opposed to checking the oft used NAME constant)  is multiple instances of a given proxy may be instantiated, in which case you may need to return something other than that constant value.

-=Cliff>
Logged
jimrobson
Courseware Beta
Newbie
***
Posts: 7


View Profile Email
« Reply #4 on: January 15, 2008, 08:11:19 »

@Cliff -

Thanks! I found it in the Model while you were posting your reply - but I appreciate your explanation.

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



View Profile WWW Email
« Reply #5 on: January 15, 2008, 08:14:55 »

You may feel free to implement IProxy rather than extend Proxy, but by the contract of the IProxy interface you will still need to implement this method.

Proxy itself has little to it. Why would you feel the need to implement IProxy rather than extend Proxy?

-=Cliff>
Logged
jimrobson
Courseware Beta
Newbie
***
Posts: 7


View Profile Email
« Reply #6 on: January 15, 2008, 08:19:56 »

I want to implement IProxy directly because I don't have a use for getData or setData.
Logged
Pages: [1]
Print