Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class BuisnessRuleContext {
- private Object Object = null;
- private applyBuisnessRule buisnessRuleName;
- public void setAbr(applyBuisnessRule abr) {
- this.buisnessRuleName = abr;
- }
- //use the strategy
- public Object applyBuisnessRule(String jobcode) {
- try {
- Object = buisnessRuleName.execute(jobcode);
- } catch (Exception e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- }
- return Object;
- }
- }
- interface applyBuisnessRule<T> {
- public T execute(String jobCode) throws Exception;
- }
- class CardvaletImpl<T> implements applyBuisnessRule<T> {
- private static final String Success = null;
- public T execute(String jobCode) throws Exception {
- T result = null;
- // put your logic and populate result here. I believe you are not going to return Success every time as it String
- return result;
- }
- }
Add Comment
Please, Sign In to add comment