Last active
August 29, 2015 14:16
-
-
Save digvijaybhakuni/34115e6e7338ab73d35a to your computer and use it in GitHub Desktop.
Creating Object Using Builder
This file contains 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
class BuilderClient{ | |
public static void builderClient(){ | |
/** | |
* Some Code | |
*/ | |
Product.Builder builder = new Product.Builder("iPhone5", "iPhone 5C", 499.90);//fill in the required field | |
builder.brand("apple").maxRetialPrice(699.99);//chaining is done as it return itself | |
Product iPhone = builder.build(); // building the immutable object of product iphone | |
/** | |
* Some Code that use iPhone object | |
*/ | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment