Chris Pratt on 20/09/07 17:20, wrote:
On 9/20/07, Adam Hardy <[EMAIL PROTECTED]> wrote:
Would it be a big deal to change com.opensymphony.xwork2.DefaultActionInvocation
to allow my Action to return an enumeration instead of a string?


How about creating a subclass of ActionSupport that has it's own
execute style method, we could call it perform, that returns an
enumeration, then by extension all your Actions could have the
behaviour you're looking for.  Something like:

public class EnumActionSupport extends ActionSupport {

  public abstract Enum perform();

  public String execute () {
    return perform().toString();
  } //execute

} //*EnumActionSupport

Of course I could do that too. At the moment I just return MyEnum.WHATEVER.toString() so the question is, which is more elegant: using an extra superclass, using .toString() on every return statement or changing the ActionInvocation?

I guess you get questions like this on the dev list all the time, people asking for tweaks and bells and whistles. But I can't see any disadvantage if the ActionInvocation called toString() instead of trying to cast it. Obviously I'm curious to know if there are disadvantages to it as well.

Regards
Adam



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to