Skip to content

Instantly share code, notes, and snippets.

@digvijaybhakuni
Last active August 29, 2015 14:16
Show Gist options
  • Save digvijaybhakuni/34115e6e7338ab73d35a to your computer and use it in GitHub Desktop.
Save digvijaybhakuni/34115e6e7338ab73d35a to your computer and use it in GitHub Desktop.
Creating Object Using Builder
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