code_junkie

How to deal with monstrous Struts Actions?

Nov 11th, 2011
79
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.52 KB | None | 0 0
  1. Original Hierarchy: New Hierarchy:
  2.  
  3. Action Action
  4. | |
  5. | BaseA
  6. (old)ClassA |
  7. +--------+----------+
  8. | | |
  9. ClassB (new)ClassA ClassC
  10.  
  11. enum Operation {
  12. ADD, DELETE;
  13. }
  14.  
  15. ...
  16.  
  17. Operation operation = determineOperation(form);
  18. if (operation == Operation.DELETE) {
  19. doDelete(form);
  20. } else if (operation == Operation.ADD) {
  21. doAdd(form);
  22. }
Add Comment
Please, Sign In to add comment