#502 Replaced usages of System.out with logger.
This commit is contained in:
@ -22,6 +22,9 @@
|
||||
*/
|
||||
package com.iluwatar.composite;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
/**
|
||||
* The Composite pattern is a partitioning design pattern. The Composite pattern describes that a
|
||||
* group of objects is to be treated in the same way as a single instance of an object. The intent
|
||||
@ -35,20 +38,22 @@ package com.iluwatar.composite;
|
||||
*/
|
||||
public class App {
|
||||
|
||||
private static final Logger LOGGER = LoggerFactory.getLogger(App.class);
|
||||
|
||||
/**
|
||||
* Program entry point
|
||||
*
|
||||
* @param args command line args
|
||||
*/
|
||||
public static void main(String[] args) {
|
||||
System.out.println("Message from the orcs: ");
|
||||
LOGGER.info("Message from the orcs: ");
|
||||
|
||||
LetterComposite orcMessage = new Messenger().messageFromOrcs();
|
||||
orcMessage.print();
|
||||
|
||||
System.out.println("\n");
|
||||
LOGGER.info("\n");
|
||||
|
||||
System.out.println("Message from the elves: ");
|
||||
LOGGER.info("Message from the elves: ");
|
||||
|
||||
LetterComposite elfMessage = new Messenger().messageFromElves();
|
||||
elfMessage.print();
|
||||
|
@ -22,6 +22,9 @@
|
||||
*/
|
||||
package com.iluwatar.composite;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
/**
|
||||
*
|
||||
* Letter
|
||||
@ -29,6 +32,8 @@ package com.iluwatar.composite;
|
||||
*/
|
||||
public class Letter extends LetterComposite {
|
||||
|
||||
private static final Logger LOGGER = LoggerFactory.getLogger(Letter.class);
|
||||
|
||||
private char c;
|
||||
|
||||
public Letter(char c) {
|
||||
@ -37,7 +42,7 @@ public class Letter extends LetterComposite {
|
||||
|
||||
@Override
|
||||
protected void printThisBefore() {
|
||||
System.out.print(c);
|
||||
LOGGER.info(String.valueOf(c));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -22,6 +22,9 @@
|
||||
*/
|
||||
package com.iluwatar.composite;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
@ -31,6 +34,8 @@ import java.util.List;
|
||||
*/
|
||||
public class Sentence extends LetterComposite {
|
||||
|
||||
private static final Logger LOGGER = LoggerFactory.getLogger(Sentence.class);
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*/
|
||||
@ -47,6 +52,6 @@ public class Sentence extends LetterComposite {
|
||||
|
||||
@Override
|
||||
protected void printThisAfter() {
|
||||
System.out.print(".");
|
||||
LOGGER.info(".");
|
||||
}
|
||||
}
|
||||
|
@ -22,6 +22,9 @@
|
||||
*/
|
||||
package com.iluwatar.composite;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
@ -31,6 +34,8 @@ import java.util.List;
|
||||
*/
|
||||
public class Word extends LetterComposite {
|
||||
|
||||
private static final Logger LOGGER = LoggerFactory.getLogger(Word.class);
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*/
|
||||
@ -42,7 +47,7 @@ public class Word extends LetterComposite {
|
||||
|
||||
@Override
|
||||
protected void printThisBefore() {
|
||||
System.out.print(" ");
|
||||
LOGGER.info(" ");
|
||||
}
|
||||
|
||||
@Override
|
||||
|
Reference in New Issue
Block a user