#467 data-bus: remove lombok
This commit is contained in:
parent
bc4d029a87
commit
146f367188
@ -42,11 +42,5 @@
|
|||||||
<artifactId>junit</artifactId>
|
<artifactId>junit</artifactId>
|
||||||
<scope>test</scope>
|
<scope>test</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
|
||||||
<groupId>org.projectlombok</groupId>
|
|
||||||
<artifactId>lombok</artifactId>
|
|
||||||
<version>${lombok.version}</version>
|
|
||||||
<scope>provided</scope>
|
|
||||||
</dependency>
|
|
||||||
</dependencies>
|
</dependencies>
|
||||||
</project>
|
</project>
|
||||||
|
@ -23,12 +23,11 @@
|
|||||||
|
|
||||||
package com.iluwatar.databus;
|
package com.iluwatar.databus;
|
||||||
|
|
||||||
import com.iluwatar.databus.data.StoppingData;
|
|
||||||
import com.iluwatar.databus.data.StartingData;
|
|
||||||
import com.iluwatar.databus.data.MessageData;
|
import com.iluwatar.databus.data.MessageData;
|
||||||
|
import com.iluwatar.databus.data.StartingData;
|
||||||
|
import com.iluwatar.databus.data.StoppingData;
|
||||||
import com.iluwatar.databus.members.CounterMember;
|
import com.iluwatar.databus.members.CounterMember;
|
||||||
import com.iluwatar.databus.members.StatusMember;
|
import com.iluwatar.databus.members.StatusMember;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
|
||||||
|
|
||||||
import java.time.LocalDateTime;
|
import java.time.LocalDateTime;
|
||||||
|
|
||||||
@ -39,7 +38,6 @@ import java.time.LocalDateTime;
|
|||||||
*
|
*
|
||||||
* @author Paul Campbell (pcampbell@kemitix.net)
|
* @author Paul Campbell (pcampbell@kemitix.net)
|
||||||
*/
|
*/
|
||||||
@Slf4j
|
|
||||||
class App {
|
class App {
|
||||||
|
|
||||||
public static void main(String[] args) {
|
public static void main(String[] args) {
|
||||||
|
@ -25,18 +25,20 @@ package com.iluwatar.databus.data;
|
|||||||
|
|
||||||
import com.iluwatar.databus.AbstractDataType;
|
import com.iluwatar.databus.AbstractDataType;
|
||||||
import com.iluwatar.databus.DataType;
|
import com.iluwatar.databus.DataType;
|
||||||
import lombok.RequiredArgsConstructor;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* .
|
* .
|
||||||
*
|
*
|
||||||
* @author Paul Campbell (pcampbell@kemitix.net)
|
* @author Paul Campbell (pcampbell@kemitix.net)
|
||||||
*/
|
*/
|
||||||
@RequiredArgsConstructor
|
|
||||||
public class MessageData extends AbstractDataType {
|
public class MessageData extends AbstractDataType {
|
||||||
|
|
||||||
private final String message;
|
private final String message;
|
||||||
|
|
||||||
|
public MessageData(String message) {
|
||||||
|
this.message = message;
|
||||||
|
}
|
||||||
|
|
||||||
public String getMessage() {
|
public String getMessage() {
|
||||||
return message;
|
return message;
|
||||||
}
|
}
|
||||||
|
@ -25,7 +25,6 @@ package com.iluwatar.databus.data;
|
|||||||
|
|
||||||
import com.iluwatar.databus.AbstractDataType;
|
import com.iluwatar.databus.AbstractDataType;
|
||||||
import com.iluwatar.databus.DataType;
|
import com.iluwatar.databus.DataType;
|
||||||
import lombok.RequiredArgsConstructor;
|
|
||||||
|
|
||||||
import java.time.LocalDateTime;
|
import java.time.LocalDateTime;
|
||||||
|
|
||||||
@ -34,11 +33,14 @@ import java.time.LocalDateTime;
|
|||||||
*
|
*
|
||||||
* @author Paul Campbell (pcampbell@kemitix.net)
|
* @author Paul Campbell (pcampbell@kemitix.net)
|
||||||
*/
|
*/
|
||||||
@RequiredArgsConstructor
|
|
||||||
public class StartingData extends AbstractDataType {
|
public class StartingData extends AbstractDataType {
|
||||||
|
|
||||||
private final LocalDateTime when;
|
private final LocalDateTime when;
|
||||||
|
|
||||||
|
public StartingData(LocalDateTime when) {
|
||||||
|
this.when = when;
|
||||||
|
}
|
||||||
|
|
||||||
public LocalDateTime getWhen() {
|
public LocalDateTime getWhen() {
|
||||||
return when;
|
return when;
|
||||||
}
|
}
|
||||||
|
@ -25,7 +25,6 @@ package com.iluwatar.databus.data;
|
|||||||
|
|
||||||
import com.iluwatar.databus.AbstractDataType;
|
import com.iluwatar.databus.AbstractDataType;
|
||||||
import com.iluwatar.databus.DataType;
|
import com.iluwatar.databus.DataType;
|
||||||
import lombok.RequiredArgsConstructor;
|
|
||||||
|
|
||||||
import java.time.LocalDateTime;
|
import java.time.LocalDateTime;
|
||||||
|
|
||||||
@ -34,11 +33,14 @@ import java.time.LocalDateTime;
|
|||||||
*
|
*
|
||||||
* @author Paul Campbell (pcampbell@kemitix.net)
|
* @author Paul Campbell (pcampbell@kemitix.net)
|
||||||
*/
|
*/
|
||||||
@RequiredArgsConstructor
|
|
||||||
public class StoppingData extends AbstractDataType {
|
public class StoppingData extends AbstractDataType {
|
||||||
|
|
||||||
private final LocalDateTime when;
|
private final LocalDateTime when;
|
||||||
|
|
||||||
|
public StoppingData(LocalDateTime when) {
|
||||||
|
this.when = when;
|
||||||
|
}
|
||||||
|
|
||||||
public LocalDateTime getWhen() {
|
public LocalDateTime getWhen() {
|
||||||
return when;
|
return when;
|
||||||
}
|
}
|
||||||
|
@ -26,20 +26,24 @@ package com.iluwatar.databus.members;
|
|||||||
import com.iluwatar.databus.DataType;
|
import com.iluwatar.databus.DataType;
|
||||||
import com.iluwatar.databus.Member;
|
import com.iluwatar.databus.Member;
|
||||||
import com.iluwatar.databus.data.MessageData;
|
import com.iluwatar.databus.data.MessageData;
|
||||||
import lombok.RequiredArgsConstructor;
|
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import java.util.logging.Logger;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Receiver of Data-Bus events.
|
* Receiver of Data-Bus events.
|
||||||
*
|
*
|
||||||
* @author Paul Campbell (pcampbell@kemitix.net)
|
* @author Paul Campbell (pcampbell@kemitix.net)
|
||||||
*/
|
*/
|
||||||
@Slf4j
|
|
||||||
@RequiredArgsConstructor
|
|
||||||
public class CounterMember implements Member {
|
public class CounterMember implements Member {
|
||||||
|
|
||||||
|
private static final Logger LOGGER = Logger.getLogger(CounterMember.class.getName());
|
||||||
|
|
||||||
private final String name;
|
private final String name;
|
||||||
|
|
||||||
|
public CounterMember(String name) {
|
||||||
|
this.name = name;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void accept(final DataType data) {
|
public void accept(final DataType data) {
|
||||||
if (data instanceof MessageData) {
|
if (data instanceof MessageData) {
|
||||||
@ -48,6 +52,6 @@ public class CounterMember implements Member {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void handleEvent(MessageData data) {
|
private void handleEvent(MessageData data) {
|
||||||
log.info("{} sees message {}", name, data.getMessage());
|
LOGGER.info(String.format("%s sees message %s", name, data.getMessage()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -28,20 +28,24 @@ import com.iluwatar.databus.Member;
|
|||||||
import com.iluwatar.databus.data.MessageData;
|
import com.iluwatar.databus.data.MessageData;
|
||||||
import com.iluwatar.databus.data.StartingData;
|
import com.iluwatar.databus.data.StartingData;
|
||||||
import com.iluwatar.databus.data.StoppingData;
|
import com.iluwatar.databus.data.StoppingData;
|
||||||
import lombok.RequiredArgsConstructor;
|
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import java.util.logging.Logger;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Receiver of Data-Bus events.
|
* Receiver of Data-Bus events.
|
||||||
*
|
*
|
||||||
* @author Paul Campbell (pcampbell@kemitix.net)
|
* @author Paul Campbell (pcampbell@kemitix.net)
|
||||||
*/
|
*/
|
||||||
@Slf4j
|
|
||||||
@RequiredArgsConstructor
|
|
||||||
public class StatusMember implements Member {
|
public class StatusMember implements Member {
|
||||||
|
|
||||||
|
private static final Logger LOGGER = Logger.getLogger(StatusMember.class.getName());
|
||||||
|
|
||||||
private final int id;
|
private final int id;
|
||||||
|
|
||||||
|
public StatusMember(int id) {
|
||||||
|
this.id = id;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void accept(final DataType data) {
|
public void accept(final DataType data) {
|
||||||
if (data instanceof StartingData) {
|
if (data instanceof StartingData) {
|
||||||
@ -52,12 +56,12 @@ public class StatusMember implements Member {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void handleEvent(StartingData data) {
|
private void handleEvent(StartingData data) {
|
||||||
log.info("Receiver #{} sees application started at {}", id, data.getWhen());
|
LOGGER.info(String.format("Receiver #%d sees application started at %s", id, data.getWhen()));
|
||||||
}
|
}
|
||||||
|
|
||||||
private void handleEvent(StoppingData data) {
|
private void handleEvent(StoppingData data) {
|
||||||
log.info("Receiver #{} sees application stopping at {}", id, data.getWhen());
|
LOGGER.info(String.format("Receiver #%d sees application stopping at %s", id, data.getWhen()));
|
||||||
log.info("Receiver #{} sending goodbye message", id);
|
LOGGER.info(String.format("Receiver #%d sending goodbye message", id));
|
||||||
data.getDataBus().publish(MessageData.of(String.format("Goodbye cruel world from #%d!", id)));
|
data.getDataBus().publish(MessageData.of(String.format("Goodbye cruel world from #%d!", id)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user