#502 Replaced usages of System.out with logger.

This commit is contained in:
daniel-bryla
2016-10-23 19:59:03 +02:00
parent 4ca205c03c
commit 0438811489
154 changed files with 1155 additions and 792 deletions

View File

@ -22,6 +22,9 @@
*/
package com.iluwatar.templatemethod;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/**
*
* HitAndRunMethod implementation of {@link StealingMethod}.
@ -29,6 +32,8 @@ package com.iluwatar.templatemethod;
*/
public class HitAndRunMethod extends StealingMethod {
private static final Logger LOGGER = LoggerFactory.getLogger(HitAndRunMethod.class);
@Override
protected String pickTarget() {
return "old goblin woman";
@ -36,11 +41,11 @@ public class HitAndRunMethod extends StealingMethod {
@Override
protected void confuseTarget(String target) {
System.out.println("Approach the " + target + " from behind.");
LOGGER.info("Approach the {} from behind.", target);
}
@Override
protected void stealTheItem(String target) {
System.out.println("Grab the handbag and run away fast!");
LOGGER.info("Grab the handbag and run away fast!");
}
}

View File

@ -22,6 +22,9 @@
*/
package com.iluwatar.templatemethod;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/**
*
* StealingMethod defines skeleton for the algorithm.
@ -29,6 +32,8 @@ package com.iluwatar.templatemethod;
*/
public abstract class StealingMethod {
private static final Logger LOGGER = LoggerFactory.getLogger(StealingMethod.class);
protected abstract String pickTarget();
protected abstract void confuseTarget(String target);
@ -40,7 +45,7 @@ public abstract class StealingMethod {
*/
public void steal() {
String target = pickTarget();
System.out.println("The target has been chosen as " + target + ".");
LOGGER.info("The target has been chosen as {}.", target);
confuseTarget(target);
stealTheItem(target);
}

View File

@ -22,6 +22,9 @@
*/
package com.iluwatar.templatemethod;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/**
*
* SubtleMethod implementation of {@link StealingMethod}.
@ -29,6 +32,8 @@ package com.iluwatar.templatemethod;
*/
public class SubtleMethod extends StealingMethod {
private static final Logger LOGGER = LoggerFactory.getLogger(SubtleMethod.class);
@Override
protected String pickTarget() {
return "shop keeper";
@ -36,11 +41,11 @@ public class SubtleMethod extends StealingMethod {
@Override
protected void confuseTarget(String target) {
System.out.println("Approach the " + target + " with tears running and hug him!");
LOGGER.info("Approach the {} with tears running and hug him!", target);
}
@Override
protected void stealTheItem(String target) {
System.out.println("While in close contact grab the " + target + "'s wallet.");
LOGGER.info("While in close contact grab the {}'s wallet.", target);
}
}