Multiple @HandlesEvent

View: New views
4 Messages — Rating Filter:   Alert me  

Multiple @HandlesEvent

by Grzegorz Krugły :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hello,

Is it possible to use multiple @HandlesEvent on a single action method?
I don't like my current solution which is like this:

@HandlesEvent('nowy')
public Resolution create() {
    return edit();
}

@HandlesEvent('edycja')
public Resolution edit() {
    // code
}



Wouldn't it be better to just write

@HandlesEvents({
    @HandlesEvent('nowy')
    @HandlesEvent('edycja')
})
public Resolution edit() {
    // code
}


Best regards,
Grzegorz


------------------------------------------------------------------------------
Come build with us! The BlackBerry® Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay
ahead of the curve. Join us from November 9-12, 2009. Register now!
http://p.sf.net/sfu/devconf
_______________________________________________
Stripes-users mailing list
Stripes-users@...
https://lists.sourceforge.net/lists/listinfo/stripes-users

Re: Multiple @HandlesEvent

by Alex Wibowo :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

I think you need to rethink the design of your method. I generally try to keep a method to be as simple as possible (i.e. do one thing, instead of multiple things)

2009/10/2 Grzegorz Krugły <gk@...>
Hello,

Is it possible to use multiple @HandlesEvent on a single action method?
I don't like my current solution which is like this:

@HandlesEvent('nowy')
public Resolution create() {
   return edit();
}

@HandlesEvent('edycja')
public Resolution edit() {
   // code
}



Wouldn't it be better to just write

@HandlesEvents({
   @HandlesEvent('nowy')
   @HandlesEvent('edycja')
})
public Resolution edit() {
   // code
}


Best regards,
Grzegorz


------------------------------------------------------------------------------
Come build with us! The BlackBerry&reg; Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay
ahead of the curve. Join us from November 9&#45;12, 2009. Register now&#33;
http://p.sf.net/sfu/devconf
_______________________________________________
Stripes-users mailing list
Stripes-users@...
https://lists.sourceforge.net/lists/listinfo/stripes-users



--
Best regards,


WiB


------------------------------------------------------------------------------
Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay
ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference
_______________________________________________
Stripes-users mailing list
Stripes-users@...
https://lists.sourceforge.net/lists/listinfo/stripes-users

Re: Multiple @HandlesEvent

by Grzegorz Krugły :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Why would I separate editing from creating? It would be 99.9% of
repeating myself.


Alex Wibowo pisze:
> I think you need to rethink the design of your method. I generally try
> to keep a method to be as simple as possible (i.e. do one thing,
> instead of multiple things)
>


------------------------------------------------------------------------------
Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay
ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference
_______________________________________________
Stripes-users mailing list
Stripes-users@...
https://lists.sourceforge.net/lists/listinfo/stripes-users

Re: Multiple @HandlesEvent

by Alex Wibowo :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Oh sorry... i didnt see your method name >.< apology..

hmmm ... if thats the case.... why cant you just use one event name (and method)... say 'persist' ?

trying to understand what you are trying to achieve by having two different event handler there, with one just calling to another >.<


2009/10/19 Grzegorz Krugły <gk@...>
Why would I separate editing from creating? It would be 99.9% of
repeating myself.


Alex Wibowo pisze:
> I think you need to rethink the design of your method. I generally try
> to keep a method to be as simple as possible (i.e. do one thing,
> instead of multiple things)
>


------------------------------------------------------------------------------
Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay
ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference
_______________________________________________
Stripes-users mailing list
Stripes-users@...
https://lists.sourceforge.net/lists/listinfo/stripes-users



--
Best regards,


WiB


------------------------------------------------------------------------------
Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay
ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference
_______________________________________________
Stripes-users mailing list
Stripes-users@...
https://lists.sourceforge.net/lists/listinfo/stripes-users