Created
July 12, 2011 10:24
-
-
Save mgenov/1077741 to your computer and use it in GitHub Desktop.
ReceiptItemBuilder.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static class ReceiptItemBuilder { | |
private DateTime from; | |
private DateTime to; | |
private String name; | |
private Double quantity; | |
private Double price; | |
private Double discount; | |
private String referenceId; | |
public ReceiptItemBuilder from(DateTime from) { | |
this.from = from; | |
return this; | |
} | |
public ReceiptItemBuilder to(DateTime to) { | |
this.to = to; | |
return this; | |
} | |
public ReceiptItemBuilder named(String name) { | |
this.name = name; | |
return this; | |
} | |
public ReceiptItemBuilder quantityOf(Double quantity) { | |
this.quantity = quantity; | |
return this; | |
} | |
public ReceiptItemBuilder priceOf(Double price) { | |
this.price = price; | |
return this; | |
} | |
public ReceiptItemBuilder discountOf(Double discount) { | |
this.discount = discount; | |
return this; | |
} | |
public ReceiptItemBuilder referencing(String referenceId) { | |
this.referenceId = referenceId; | |
return this; | |
} | |
public ReceiptItem build() { | |
return new ReceiptItem(from, to, name,quantity, price,discount,referenceId); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment