Created
November 22, 2020 05:27
-
-
Save sanchikagn/7890c5ce1d23dc13a79d050cbfa6949f 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 NewYorkStylePizza extends Pizza { | |
| private final Size size; | |
| NewYorkStylePizza(Builder builder) { | |
| super(builder); | |
| size = builder.size; | |
| } | |
| public static class Builder extends Pizza.Builder<Builder> { | |
| private final Size size; | |
| public Builder(Size size) { | |
| this.size = Objects.requireNonNull(size); | |
| } | |
| @Override | |
| public NewYorkStylePizza build(){ | |
| return new NewYorkStylePizza(this); | |
| } | |
| @Override | |
| protected Builder self() { | |
| return this; | |
| } | |
| } | |
| public enum Size{ | |
| SMALL, | |
| MEDIUM, | |
| LARGE | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment