Files
java-design-patterns/template-method/src/main/java/com/iluwatar/templatemethod/StealingMethod.java

26 lines
542 B
Java
Raw Normal View History

package com.iluwatar.templatemethod;
2014-08-23 13:37:42 +03:00
2014-08-31 11:31:03 +03:00
/**
*
* StealingMethod defines skeleton for the algorithm.
*
2014-08-31 11:31:03 +03:00
*/
2014-08-23 13:37:42 +03:00
public abstract class StealingMethod {
protected abstract String pickTarget();
protected abstract void confuseTarget(String target);
protected abstract void stealTheItem(String target);
2014-08-23 13:37:42 +03:00
/**
* Steal
*/
public void steal() {
String target = pickTarget();
System.out.println("The target has been chosen as " + target + ".");
confuseTarget(target);
stealTheItem(target);
}
2014-08-23 13:37:42 +03:00
}