Skip to content

Instantly share code, notes, and snippets.

@rohitvvv
Created July 21, 2019 04:43
Show Gist options
  • Save rohitvvv/e52c6e3f31b33f856e4c86cee8d22eee to your computer and use it in GitHub Desktop.
Save rohitvvv/e52c6e3f31b33f856e4c86cee8d22eee to your computer and use it in GitHub Desktop.
public class LinkRenderer {
void renderLink(String linkType) {
switch (linkType) {
case "LinkAndTextBelow":
renderLinkAndTextBelow(new LinkAndTextBelow());
break;
case "LinkAndTextAdjacent":
renderLinkAndTextAdjacent(new LinkAndTextAdjacent());
break;
default:
System.out.println("Link Only");
}
}
public void renderLinkAndTextBelow(LinkAndTextBelow link) {
System.out.println("Link and Text Below");
}
public void renderLinkAndTextAdjacent(LinkAndTextAdjacent linkAndTextAdjacent) {
System.out.println("Link And Text Adjacent");
}
}
class Link {
public String linkType;
}
class LinkAndTextBelow extends Link {
LinkAndTextBelow() {
super.linkType = "LinkAndTextBelow";
}
}
class LinkAndTextAdjacent extends Link {
LinkAndTextAdjacent() {
super.linkType = "LinkAndTextAdjacent";
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment