Last active
November 9, 2016 19:49
-
-
Save kcrimi/9f70504719024d822b443535e5ff448d to your computer and use it in GitHub Desktop.
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
public abstract class Slide { | |
private String title; | |
private String text; | |
public class Builder { | |
Slide slide; | |
public Builder(String type) { | |
if ("ICON".equals(type)) { | |
slide = new IconSlide(); | |
} else { | |
slide = new AgeSlide(); | |
} | |
} | |
public Builder setTitle(String title) { | |
slide.title = title; | |
return this; | |
} | |
public Slide build() { | |
return slide; | |
} | |
} | |
} | |
public class IconSlide extends Slide { | |
Icon icon; | |
} | |
public class AgeSlide extends Slide { | |
int age; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment