[typedevent] Improve spacing in the Typed Event Examples
@@ -215,18 +215,14 @@ public class ExampleEvent {
public String message;
}
-
@Component
public class ExampleEventSource {
-
private ExampleEvent createEventFromJavaBean(ExampleJavaBean bean) {
-
return Converters.standardConverter().convert(bean)
.to(ExampleEvent.class);
}
private Map&lt;String, Object&gt; createMapFromJavaBean(ExampleJavaBean bean) {
-
return Converters.standardConverter().convert(bean)
.to(new TypeReference&lt;Map&gt;String, Object&gt;&gt;(){});
}
@@ -276,15 +272,12 @@ public class ExampleEventSource {
public String message;
}
-
@Component
public class ExampleEventSource {
-
@Reference
TypedEventBus bus;
public void sendEvent() {
-
ExampleEvent event = new ExampleEvent();
event.message = "The time is " + LocalDateTime.now();
@@ -338,15 +331,12 @@ public class ExampleEvent {
public String message;
}
-
@Component
public class ExampleEventSource {
-
@Reference
TypedEventBus bus;
public void sendEvent() {
-
ExampleEvent event = new ExampleEvent();
event.message = "The time is " + LocalDateTime.now();
@@ -394,12 +384,10 @@ public class ExampleEventSource {
@Component
public class ExampleTypedConsumer implements TypedEventHandler&lt;ExampleEvent&gt; {
-
@Override
public void notify(String topic, ExampleEvent event) {
System.out.println("Received event: " + event.message);
}
-
}</programlisting>
<para>If the TypedEventHandler implementation is unable to reify the type, or the required type is
@@ -416,15 +404,12 @@ public class ExampleTypedConsumer implements TypedEventHandler&lt;ExampleEvent&g
}
public class SpecialisedExampleEvent extends ExampleEvent {
-
public int sequenceId = Integer.MIN_VALUE;
-
}
@Component
@EventType(SpecialisedExampleEvent.class)
public class ExampleTypedConsumer implements TypedEventHandler&lt;ExampleEvent&gt; {
-
@Override
public void notify(String topic, ExampleEvent event) {
System.out.println("Received event: " + event.message);
@@ -447,7 +432,6 @@ public class ExampleTypedConsumer implements TypedEventHandler&lt;ExampleEvent&g
@Component
@EventTopics({"foo", "foo/bar"})
public class ExampleTypedConsumer implements TypedEventHandler&lt;ExampleEvent&gt; {
-
@Override
public void notify(String topic, ExampleEvent event) {
System.out.println("Event received on topic: " + topic +
@@ -477,7 +461,6 @@ public class ExampleTypedConsumer implements TypedEventHandler&lt;ExampleEvent&g
@Component
@EventTopics({"foo", "foo/bar"})
public class ExampleUntypedConsumer implements UntypedEventHandler {
-
@Override
public void notifyUntyped(String topic, Map&lt;String,Object&gt; event) {
System.out.println("Event received on topic: " + topic
@@ -510,7 +493,6 @@ public class ExampleUntypedConsumer implements UntypedEventHandler {
@Component
public class ExampleUnhandledConsumer implements UnhandledEventHandler {
-
@Override
public void notifyUnhandled(String topic, Map&lt;String,Object&gt; event) {
System.out.println("Unhandled Event received on topic: " + topic);
