Created
November 26, 2015 01:59
-
-
Save nhatchimai111/5ea72a1414ddd5c969c7 to your computer and use it in GitHub Desktop.
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 class Flower { | |
public String mCategory, mInstructions, mPhoto, mName; | |
public double mPrice; | |
public int mProductId; | |
private Flower(Builder builder){ | |
mCategory = builder.mCategory; | |
mInstructions = builder.mInstructions; | |
mPhoto = builder.mPhoto; | |
mName = builder.mName; | |
mPrice = builder.mPrice; | |
mProductId = builder.mProductId; | |
} | |
public static class Builder { | |
private String mCategory, mInstructions, mPhoto, mName; | |
private double mPrice; | |
private int mProductId; | |
public Builder setCategory(String category) { | |
mCategory = category; | |
return Builder.this; | |
} | |
public Builder setInstructions(String instructions) { | |
mInstructions = instructions; | |
return Builder.this; | |
} | |
public Builder setPhoto(String photo) { | |
mPhoto = photo; | |
return Builder.this; | |
} | |
public Builder setName(String name) { | |
mName = name; | |
return Builder.this; | |
} | |
public Builder setPrice(double price) { | |
mPrice = price; | |
return Builder.this; | |
} | |
public Builder setProductId(int productId) { | |
mProductId = productId; | |
return Builder.this; | |
} | |
public Flower build() { | |
return new Flower(Builder.this); | |
} | |
} | |
} |
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 class Flower { | |
public String mCategory, mInstructions, mPhoto, mName; | |
public double mPrice; | |
public int mProductId; | |
private Flower(String mCategory, mInstructions, String mPhoto, String mName, double mPrice, int mProductId){ | |
mCategory = this.mCategory; | |
mInstructions = this.mInstructions; | |
mPhoto = this.mPhoto; | |
mName = this.mName; | |
mPrice = this.mPrice; | |
mProductId = this.mProductId; | |
} | |
public String setInstructions(String mInstructions) { | |
mInstructions = this.mInstructions; | |
} | |
public Builder setPhoto(String mPhoto) { | |
mPhoto = this.mPhoto; | |
} | |
public Builder setName(String mName) { | |
mName = this.Name; | |
} | |
public Builder setPrice(double mPrice) { | |
mPrice = this.mPrice; | |
} | |
public Builder setProductId(int mProductId) { | |
mProductId = this.mProductId; | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment