Advertisement
NelloRizzo

Builder di Straordinario

Jan 10th, 2018
332
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.75 KB | None | 0 0
  1. package it.dia_net.droid.mydia;
  2.  
  3. import java.util.Date;
  4.  
  5. /**
  6.  * Created by Nello on 10/01/2018.
  7.  */
  8.  
  9. public class Straordinario {
  10.     public final Date date;
  11.     public final int total;
  12.  
  13.     private Straordinario(Date date, int total) {
  14.         this.date = date;
  15.         this.total = total;
  16.     }
  17.  
  18.     public static class Builder {
  19.         private Date date;
  20.         private int total;
  21.  
  22.         public Builder withDate(Date date) {
  23.             this.date = date;
  24.             return this;
  25.         }
  26.  
  27.         public Builder withTotal(int total) {
  28.             this.total = total;
  29.             return this;
  30.         }
  31.  
  32.         public Straordinario getStraordinario() {
  33.             return new Straordinario(date, total);
  34.         }
  35.     }
  36. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement