2 * Copyright (C) 2016 Roland Haeder
4 * This program is free software: you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation, either version 3 of the License, or
7 * (at your option) any later version.
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
14 * You should have received a copy of the GNU General Public License
15 * along with this program. If not, see <http://www.gnu.org/licenses/>.
17 package org.mxchange.jusercore.events.registration;
19 import java.text.MessageFormat;
20 import org.mxchange.jusercore.model.user.User;
23 * An event, fireed if a new registeredUser has registered
25 * @author Roland Haeder<roland@mxchange.org>
27 public class RegisteredUserEvent implements UserRegisteredEvent {
32 private static final long serialVersionUID = 186_956_974_127_691L;
35 * Newly registered registeredUser;
37 private final User registeredUser;
40 * Constructor with newly registered registeredUser
42 * @param registeredUser Newly registered registeredUser
44 public RegisteredUserEvent (final User registeredUser) {
45 // Is the registered user instance valid?
46 if (null == registeredUser) {
48 throw new NullPointerException("registeredUser is null"); //NOI18N
49 } else if (registeredUser.getUserId() == null) {
51 throw new NullPointerException("registeredUser.userId is null"); //NOI18N
52 } else if (registeredUser.getUserId() < 1) {
54 throw new IllegalArgumentException(MessageFormat.format("registeredUser.userId={0} is invalid.", registeredUser.getUserId())); //NOI18N
58 this.registeredUser = registeredUser;
62 * Getter for registeredUser instance
64 * @return User instance
67 public User getRegisteredUser () {
68 return this.registeredUser;