andreschaffer/event-sourcing-cqrs-examples

View on GitHub
src/main/java/bankservice/domain/model/client/ClientEnrolledEvent.java

Summary

Maintainability
A
1 hr
Test Coverage
A
100%
package bankservice.domain.model.client;

import static com.google.common.base.Preconditions.checkNotNull;

import bankservice.domain.model.Event;
import java.time.ZonedDateTime;
import java.util.UUID;

public class ClientEnrolledEvent extends Event {

  private final String name;
  private final String email;

  public ClientEnrolledEvent(UUID aggregateId, ZonedDateTime timestamp, int version, String name,
      Email email) {
    super(aggregateId, timestamp, version);
    this.name = checkNotNull(name);
    this.email = checkNotNull(email).getValue();
  }

  public String getName() {
    return name;
  }

  public Email getEmail() {
    return new Email(email);
  }
}