#113 Event Driven Architecture

Adds more Javadoc
This commit is contained in:
cfarrugia
2015-11-28 13:12:16 +01:00
parent fc70a706c6
commit b8b94b697a
12 changed files with 112 additions and 61 deletions

View File

@@ -2,8 +2,25 @@ package com.iluwatar.eda.event;
import com.iluwatar.eda.framework.Message;
/**
* The {@link Event} class serves as a base class for defining custom events happening with your
* system. In this example we have two types of events defined.
* <ul>
* <li>{@link UserCreatedEvent} - used when a user is created</li>
* <li>{@link UserUpdatedEvent} - used when a user is updated</li>
* </ul>
* Events can be distinguished using the {@link #getType() getType} method.
*/
public class Event implements Message {
public Class<? extends Message> getType() {
return getClass();
}
/**
* Returns the event type as a {@link Class} object
* In this example, this method is used by the {@link com.iluwatar.eda.EventDispatcher} to
* dispatch events depending on their type.
*
* @return the Event type as a {@link Class}.
*/
public Class<? extends Message> getType() {
return getClass();
}
}

View File

@@ -1,7 +1,8 @@
package com.iluwatar.eda.event;
/**
* @author cfarrugia
* The {@link UserCreatedEvent} class should should be dispatched whenever a user has been created.
* This class can be extended to contain details about the user has been created.
*/
public class UserCreatedEvent extends Event {
}

View File

@@ -1,4 +1,8 @@
package com.iluwatar.eda.event;
/**
* The {@link UserUpdatedEvent} class should should be dispatched whenever a user has been updated.
* This class can be extended to contain details about the user has been updated.
*/
public class UserUpdatedEvent extends Event {
}