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

changeset 33
fd8c40ff78c3
parent 29
27a0fdd7bca7
child 37
fecda0f466e6
equal deleted inserted replaced
32:63a31871189e 33:fd8c40ff78c3
1 /* 1 /*
2 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. 2 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
3 * 3 *
4 * Copyright 2018 Mike Becker. All rights reserved. 4 * Copyright 2018 Mike Becker. All rights reserved.
5 * 5 *
6 * Redistribution and use in source and binary forms, with or without 6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions are met: 7 * modification, are permitted provided that the following conditions are met:
8 * 8 *
9 * 1. Redistributions of source code must retain the above copyright 9 * 1. Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer. 10 * notice, this list of conditions and the following disclaimer.
22 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 22 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
23 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 23 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
24 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 24 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
25 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 25 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
26 * POSSIBILITY OF SUCH DAMAGE. 26 * POSSIBILITY OF SUCH DAMAGE.
27 * 27 *
28 */ 28 */
29 package de.uapcore.lightpit.entities; 29 package de.uapcore.lightpit.entities;
30 30
31 import java.util.Optional; 31 public final class User {
32 32
33 public final class User {
34
35 public static final int ANONYMOUS_USERID = -1; 33 public static final int ANONYMOUS_USERID = -1;
36 34
37 private int userID; 35 private int userID;
38 private String username; 36 private String username;
39 private Optional<String> givenname; 37 private String givenname;
40 private Optional<String> lastname; 38 private String lastname;
41 39
42 public int getUserID() { 40 public int getUserID() {
43 return userID; 41 return userID;
44 } 42 }
45 43
53 51
54 public void setUsername(String username) { 52 public void setUsername(String username) {
55 this.username = username; 53 this.username = username;
56 } 54 }
57 55
58 public Optional<String> getGivenname() { 56 public String getGivenname() {
59 return givenname; 57 return givenname;
60 } 58 }
61 59
62 public void setGivenname(Optional<String> givenname) { 60 public void setGivenname(String givenname) {
63 this.givenname = givenname; 61 this.givenname = givenname;
64 } 62 }
65 63
66 public Optional<String> getLastname() { 64 public String getLastname() {
67 return lastname; 65 return lastname;
68 } 66 }
69 67
70 public void setLastname(Optional<String> lastname) { 68 public void setLastname(String lastname) {
71 this.lastname = lastname; 69 this.lastname = lastname;
72 } 70 }
73 71
74 @Override 72 @Override
75 public int hashCode() { 73 public int hashCode() {
86 if (obj == null || getClass() != obj.getClass()) { 84 if (obj == null || getClass() != obj.getClass()) {
87 return false; 85 return false;
88 } else { 86 } else {
89 return this.userID == ((User) obj).userID; 87 return this.userID == ((User) obj).userID;
90 } 88 }
91 } 89 }
92 } 90 }

mercurial