Guest User

Untitled

a guest
May 23rd, 2018
93
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.96 KB | None | 0 0
  1. public class BuisnessRuleContext {
  2.  
  3.  
  4. private Object Object = null;
  5. private applyBuisnessRule buisnessRuleName;
  6.  
  7. public void setAbr(applyBuisnessRule abr) {
  8. this.buisnessRuleName = abr;
  9. }
  10.  
  11. //use the strategy
  12. public Object applyBuisnessRule(String jobcode) {
  13.  
  14. try {
  15. Object = buisnessRuleName.execute(jobcode);
  16. } catch (Exception e) {
  17. // TODO Auto-generated catch block
  18. e.printStackTrace();
  19. }
  20.  
  21. return Object;
  22. }
  23.  
  24. }
  25.  
  26. interface applyBuisnessRule<T> {
  27. public T execute(String jobCode) throws Exception;
  28. }
  29.  
  30. class CardvaletImpl<T> implements applyBuisnessRule<T> {
  31. private static final String Success = null;
  32.  
  33. public T execute(String jobCode) throws Exception {
  34. T result = null;
  35. // put your logic and populate result here. I believe you are not going to return Success every time as it String
  36. return result;
  37. }
  38. }
Add Comment
Please, Sign In to add comment