Skip to content

Commit 4a773e7

Browse files
authored
BAEL-393: renamed guice-intro directory to guice (eugenp#1385)
* Add files via upload * Update pom.xml * Update RunGuice.java * Update Communication.java * Update CommunicationMode.java * Update DefaultCommunicator.java * Update EmailCommunicationMode.java * Update IMCommunicationMode.java * Update SMSCommunicationMode.java * Update MessageLogger.java * Update MessageSentLoggable.java * Update AOPModule.java * Update BasicModule.java * Update CommunicationModel.java * Update Communicator.java * Update BasicModule.java * Update RunGuice.java * Update MessageLogger.java * Update Communicator.java * Update pom.xml * BAEL-278: Updated README.md * BAEL-554: Add and update README.md files * Update pom.xml * Update pom.xml * Update pom.xml * BAEL-345: fixed assertion * BAEL-109: Updated README.md * BAEL-345: Added README.md * Reinstating reactor-core module in root-level pom * BAEL-393: Adding guide-intro module to root pom * BAEL-9: Updated README.md * BAEL-157: README.md updated * Changed project name * Update RunGuice.java Removed references to message logging and output * Update Communication.java Removed message logging-related code * BAEL-566: Updated README.md * New project name * BAEL-393: removing guice-intro directory * BAEL-393: renamed module guice-intro to guice in root pom.xml
1 parent d32d3ed commit 4a773e7

17 files changed

Lines changed: 44 additions & 50 deletions

File tree

guice-intro/src/main/java/com/baeldung/examples/guice/marker/Communicator.java

Lines changed: 0 additions & 11 deletions
This file was deleted.
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
33
<modelVersion>4.0.0</modelVersion>
44
<groupId>com.baeldung.examples.guice</groupId>
5-
<artifactId>guice-intro</artifactId>
5+
<artifactId>guice</artifactId>
66
<version>1.0-SNAPSHOT</version>
77
<packaging>jar</packaging>
88
<dependencies>
@@ -30,5 +30,5 @@
3030
<maven.compiler.target>1.8</maven.compiler.target>
3131
<guice.version>4.1.0</guice.version>
3232
</properties>
33-
<name>guice-intro</name>
33+
<name>guice</name>
3434
</project>

guice-intro/src/main/java/com/baeldung/examples/RunGuice.java renamed to guice/src/main/java/com/baeldung/examples/RunGuice.java

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,22 +10,18 @@
1010

1111
/**
1212
*
13-
* @author Baeldung
13+
* @author baeldung
1414
*/
1515
public class RunGuice {
1616

1717
public static void main(String[] args) {
1818
Injector injector = Guice.createInjector(new BasicModule(), new AOPModule());
1919
Communication comms = injector.getInstance(Communication.class);
2020
Scanner scanner = new Scanner(System.in);
21-
System.out.println("Enter your message to be sent; press Q to quit and P to print the message log");
2221
while (true) {
2322
String input = scanner.nextLine();
2423
if (input.equalsIgnoreCase("q")) {
2524
System.exit(0);
26-
}
27-
if (input.equalsIgnoreCase("p")) {
28-
comms.print();
2925
} else {
3026
comms.sendMessage(input);
3127
}

guice-intro/src/main/java/com/baeldung/examples/guice/Communication.java renamed to guice/src/main/java/com/baeldung/examples/guice/Communication.java

Lines changed: 4 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010

1111
/**
1212
*
13-
* @author Baeldung
13+
* @author baeldung
1414
*/
1515
public class Communication {
1616

@@ -19,37 +19,20 @@ public class Communication {
1919
@Inject
2020
private Logger logger;
2121

22-
private Queue<String> messageLog;
23-
24-
@Named("CommsUUID")
25-
private String commsID;
26-
2722
@Inject
2823
private DefaultCommunicator communicator;
2924

3025
public Communication(Boolean keepRecords) {
3126
if (keepRecords) {
32-
messageLog = new LinkedList();
27+
System.out.println("keeping records");
3328
}
3429
}
3530

3631
public boolean sendMessage(String message) {
37-
if (!message.isEmpty() && messageLog != null) {
38-
messageLog.add(message);
39-
}
32+
4033
return communicator.sendMessage(message);
4134
}
42-
43-
public void print() {
44-
if (messageLog != null) {
45-
for (String message : messageLog) {
46-
logger.info(message);
47-
}
48-
} else {
49-
logger.info("Message logging wasn't enabled");
50-
}
51-
}
52-
35+
5336
public DefaultCommunicator getCommunicator() {
5437
return this.communicator;
5538
}

guice-intro/src/main/java/com/baeldung/examples/guice/CommunicationMode.java renamed to guice/src/main/java/com/baeldung/examples/guice/CommunicationMode.java

File renamed without changes.

guice-intro/src/main/java/com/baeldung/examples/guice/DefaultCommunicator.java renamed to guice/src/main/java/com/baeldung/examples/guice/DefaultCommunicator.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,10 @@
55
import com.google.inject.Inject;
66
import com.google.inject.name.Named;
77

8-
8+
/**
9+
*
10+
* @author baeldung
11+
*/
912
public class DefaultCommunicator implements Communicator {
1013

1114
private CommunicationMode defaultCommsMode;

guice-intro/src/main/java/com/baeldung/examples/guice/EmailCommunicationMode.java renamed to guice/src/main/java/com/baeldung/examples/guice/EmailCommunicationMode.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
1+
12
package com.baeldung.examples.guice;
23

34
import com.baeldung.examples.guice.aop.MessageSentLoggable;
45
import com.baeldung.examples.guice.constant.CommunicationModel;
56

67
/**
78
*
8-
* @author Baekdung
9+
* @author baeldung
910
*/
1011
public class EmailCommunicationMode implements CommunicationMode {
1112

guice-intro/src/main/java/com/baeldung/examples/guice/IMCommunicationMode.java renamed to guice/src/main/java/com/baeldung/examples/guice/IMCommunicationMode.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99
/**
1010
*
11-
* @author Baeldung
11+
* @author baeldung
1212
*/
1313
public class IMCommunicationMode implements CommunicationMode {
1414

guice-intro/src/main/java/com/baeldung/examples/guice/SMSCommunicationMode.java renamed to guice/src/main/java/com/baeldung/examples/guice/SMSCommunicationMode.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
12
package com.baeldung.examples.guice;
23

34
import com.baeldung.examples.guice.aop.MessageSentLoggable;
@@ -7,7 +8,7 @@
78

89
/**
910
*
10-
* @author Baeldung
11+
* @author baeldung
1112
*/
1213
public class SMSCommunicationMode implements CommunicationMode {
1314

guice-intro/src/main/java/com/baeldung/examples/guice/aop/MessageLogger.java renamed to guice/src/main/java/com/baeldung/examples/guice/aop/MessageLogger.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,14 @@
1+
12
package com.baeldung.examples.guice.aop;
23

4+
import com.google.inject.Inject;
35
import java.util.logging.Logger;
46
import org.aopalliance.intercept.MethodInterceptor;
57
import org.aopalliance.intercept.MethodInvocation;
68

79
/**
810
*
9-
* @author Baeldung
11+
* @author baeldung
1012
*/
1113
public class MessageLogger implements MethodInterceptor {
1214

0 commit comments

Comments
 (0)