slight changes to package structure + naming
This commit is contained in:
23
src/main/java/mops/gruppen2/domain/Aggregate.java
Normal file
23
src/main/java/mops/gruppen2/domain/Aggregate.java
Normal file
@ -0,0 +1,23 @@
|
||||
package mops.gruppen2.domain;
|
||||
|
||||
import mops.gruppen2.domain.event.Event;
|
||||
|
||||
import java.lang.reflect.Method;
|
||||
|
||||
public abstract class Aggregate {
|
||||
|
||||
/**
|
||||
* Ruft die spezifische applyEvent-Methode im entsprechenden Aggregat auf.
|
||||
*
|
||||
* @param event
|
||||
*/
|
||||
public void applyEvent(Event event) {
|
||||
try {
|
||||
Method method = this.getClass().getDeclaredMethod("applyEvent", event.getClass());
|
||||
method.setAccessible(true);
|
||||
method.invoke(this, event);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user