Created
March 12, 2014 20:40
-
-
Save ngerakines/9515809 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 AbstractTemplate { | |
protected abstract String getTemplateFile(); | |
public String run() { | |
return "rendered template from " + getTemplateFile(); | |
} | |
} |
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 PartialTemplate extends AbstractTemplate { | |
protected String getTemplateFile() { | |
return "partial template file"; | |
} | |
} |
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 Template extends AbstractTemplate { | |
protected String getTemplateFile() { | |
return "full template file"; | |
} | |
} |
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 Rendererer { | |
public static void main() { | |
assert(new Template().render(), "rendered template from full template file"); | |
assert(new PartialTemplate().render(), "rendered template from partial template file"); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment