Advertisement
Guest User

Untitled

a guest
Jan 21st, 2020
118
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 2.37 KB | None | 0 0
  1. package main.java.model;
  2.  
  3. import main.java.domain.templates.Template;
  4.  
  5. public class BusinessRule {
  6.  
  7.     public static class Builder {
  8.         private String constraintName;
  9.         private Operator operator;
  10.         private Values values;
  11.         private String attributeName1;
  12.         private String attributeName2;
  13.         private String tableName1;
  14.         private String tableName2;
  15.         private Template template;
  16.  
  17.         public Builder(String constraintName) {
  18.             this.constraintName = constraintName;
  19.         }
  20.  
  21.         public void usingOperator(Operator operator) {
  22.             this.operator = operator;
  23.         }
  24.  
  25.         public void comparableValues(Values values) {
  26.             this.values = values;
  27.         }
  28.  
  29.         public void firstComparableAttribute(String attributeName1) {
  30.             this.attributeName1 = attributeName1;
  31.         }
  32.  
  33.         public void secondComparableAttribute(String attributeName2) {
  34.             this.attributeName2 = attributeName2;
  35.         }
  36.  
  37.         public void firstComparableTable(String tableName1) {
  38.             this.tableName1 = tableName1;
  39.         }
  40.  
  41.         public void secondComparableTable(String tableName2) {
  42.             this.tableName2 = tableName2;
  43.         }
  44.  
  45.         public void usingTemplate(Template template) {
  46.             this.template = template;
  47.         }
  48.  
  49.         public BusinessRule build() {
  50.             BusinessRule businessRule = new BusinessRule();
  51.  
  52.             businessRule.constraintName = this.constraintName;
  53.             businessRule.operator = this.operator;
  54.             businessRule.values = this.values;
  55.             businessRule.attributeName1 = this.attributeName1;
  56.             businessRule.attributeName2 = this.attributeName2;
  57.             businessRule.tableName1 = this.tableName1;
  58.             businessRule.tableName2 = this.tableName2;
  59.             businessRule.template = this.template;
  60.  
  61.             return businessRule;
  62.         }
  63.     }
  64.  
  65.     private String constraintName;
  66.     private Operator operator;
  67.     private Values values;
  68.     private String attributeName1;
  69.     private String attributeName2;
  70.     private String tableName1;
  71.     private String tableName2;
  72.     private Template template;
  73.  
  74.     public String getConstraintName() {
  75.         return constraintName;
  76.     }
  77.  
  78.     public Operator getOperator() {
  79.         return operator;
  80.     }
  81.  
  82.     public Values getValues() {
  83.         return values;
  84.     }
  85.  
  86.     public String getAttributeName1() {
  87.         return attributeName1;
  88.     }
  89.  
  90.     public String getAttributeName2() {
  91.         return attributeName2;
  92.     }
  93.  
  94.     public String getTableName1() {
  95.         return tableName1;
  96.     }
  97.  
  98.     public String getTableName2() {
  99.         return tableName2;
  100.     }
  101.  
  102.     public Template getTemplate() {
  103.         return template;
  104.     }
  105. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement