Created
July 21, 2019 04:43
-
-
Save rohitvvv/e52c6e3f31b33f856e4c86cee8d22eee 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 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