src/main/java/de/uapcore/lightpit/entities/User.java

Sat, 09 May 2020 14:26:31 +0200

author
Mike Becker <universe@uap-core.de>
date
Sat, 09 May 2020 14:26:31 +0200
changeset 29
27a0fdd7bca7
parent 26
src/java/de/uapcore/lightpit/entities/User.java@65d5a0ca49ae
child 33
fd8c40ff78c3
permissions
-rw-r--r--

converts to maven project

universe@21 1 /*
universe@21 2 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
universe@21 3 *
universe@24 4 * Copyright 2018 Mike Becker. All rights reserved.
universe@21 5 *
universe@21 6 * Redistribution and use in source and binary forms, with or without
universe@21 7 * modification, are permitted provided that the following conditions are met:
universe@21 8 *
universe@21 9 * 1. Redistributions of source code must retain the above copyright
universe@21 10 * notice, this list of conditions and the following disclaimer.
universe@21 11 *
universe@21 12 * 2. Redistributions in binary form must reproduce the above copyright
universe@21 13 * notice, this list of conditions and the following disclaimer in the
universe@21 14 * documentation and/or other materials provided with the distribution.
universe@21 15 *
universe@21 16 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
universe@21 17 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
universe@21 18 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
universe@21 19 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
universe@21 20 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
universe@21 21 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
universe@21 22 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
universe@21 23 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
universe@21 24 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
universe@21 25 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
universe@21 26 * POSSIBILITY OF SUCH DAMAGE.
universe@21 27 *
universe@21 28 */
universe@21 29 package de.uapcore.lightpit.entities;
universe@21 30
universe@26 31 import java.util.Optional;
universe@21 32
universe@26 33 public final class User {
universe@21 34
universe@26 35 public static final int ANONYMOUS_USERID = -1;
universe@26 36
universe@26 37 private int userID;
universe@26 38 private String username;
universe@26 39 private Optional<String> givenname;
universe@26 40 private Optional<String> lastname;
universe@21 41
universe@26 42 public int getUserID() {
universe@26 43 return userID;
universe@21 44 }
universe@21 45
universe@26 46 public void setUserID(int userID) {
universe@26 47 this.userID = userID;
universe@21 48 }
universe@21 49
universe@26 50 public String getUsername() {
universe@26 51 return username;
universe@21 52 }
universe@21 53
universe@26 54 public void setUsername(String username) {
universe@26 55 this.username = username;
universe@21 56 }
universe@21 57
universe@26 58 public Optional<String> getGivenname() {
universe@26 59 return givenname;
universe@21 60 }
universe@21 61
universe@26 62 public void setGivenname(Optional<String> givenname) {
universe@26 63 this.givenname = givenname;
universe@21 64 }
universe@21 65
universe@26 66 public Optional<String> getLastname() {
universe@26 67 return lastname;
universe@21 68 }
universe@21 69
universe@26 70 public void setLastname(Optional<String> lastname) {
universe@26 71 this.lastname = lastname;
universe@21 72 }
universe@21 73
universe@21 74 @Override
universe@21 75 public int hashCode() {
universe@21 76 int hash = 3;
universe@26 77 hash = 41 * hash + this.userID;
universe@21 78 return hash;
universe@21 79 }
universe@21 80
universe@21 81 @Override
universe@21 82 public boolean equals(Object obj) {
universe@21 83 if (this == obj) {
universe@21 84 return true;
universe@21 85 }
universe@21 86 if (obj == null || getClass() != obj.getClass()) {
universe@21 87 return false;
universe@21 88 } else {
universe@26 89 return this.userID == ((User) obj).userID;
universe@21 90 }
universe@21 91 }
universe@21 92 }

mercurial