Skip to content

Instantly share code, notes, and snippets.

@kcrimi
Last active November 9, 2016 19:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kcrimi/9f70504719024d822b443535e5ff448d to your computer and use it in GitHub Desktop.
Save kcrimi/9f70504719024d822b443535e5ff448d to your computer and use it in GitHub Desktop.
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