Changes

Jump to: navigation, search

Template Method

980 bytes removed, 17:07, 19 March 2007
Code Samples
== Code Samples ==
 
Java:
<pre>
public abstract class TitleInfo { private String titleName; //the "template method" - // calls the concrete class methods, is not overridden public final String ProcessTitleInfo() { StringBuffer titleInfo = new StringBuffer();  titleInfo.append(this.getTitleBlurb()); titleInfo.append(this.getDvdEncodingRegionInfo()); return titleInfo.toString(); } //the following 2 methods are "concrete abstract class methods" public final void setTitleName(String titleNameIn) { this.titleName = titleNameIn; } public final String getTitleName() { return this.titleName; } //this is a "primitive operation", // and must be overridden in the concrete templates public abstract String getTitleBlurb(); //this is a "hook operation", which may be overridden, //hook operations usually do nothing if not overridden public String getDvdEncodingRegionInfo() { return " "; }}
</pre>
1
edit

Navigation menu