2 * FreenetSone - Profile.java - Copyright © 2010 David Roden
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/>.
18 package net.pterodactylus.sone.data;
21 * A profile stores personal information about a {@link Sone}. All information
22 * is optional and can be {@code null}.
24 * @author <a href="mailto:bombe@pterodactylus.net">David ‘Bombe’ Roden</a>
26 public class Profile {
28 /** Whether the profile was modified. */
29 private boolean modified;
31 /** The first name. */
32 private String firstName;
34 /** The middle name(s). */
35 private String middleName;
38 private String lastName;
41 * Creates a new empty profile.
48 * Creates a copy of a profile.
53 public Profile(Profile profile) {
54 this.firstName = profile.firstName;
55 this.middleName = profile.middleName;
56 this.lastName = profile.lastName;
64 * Returns whether this profile was modified after creation. To clear the
65 * “is modified” flag you need to create a new profile from this one using
66 * the {@link #Profile(Profile)} constructor.
68 * @return {@code true} if this profile was modified after creation,
69 * {@code false} otherwise
71 public boolean isModified() {
76 * Returns the first name.
78 * @return The first name
80 public String getFirstName() {
85 * Sets the first name.
88 * The first name to set
90 public void setFirstName(String firstName) {
91 modified |= ((firstName != null) && (!firstName.equals(this.firstName))) || (this.firstName != null);
92 this.firstName = firstName;
96 * Returns the middle name(s).
98 * @return The middle name
100 public String getMiddleName() {
105 * Sets the middle name.
108 * The middle name to set
110 public void setMiddleName(String middleName) {
111 modified |= ((middleName != null) && (!middleName.equals(this.middleName))) || (this.middleName != null);
112 this.middleName = middleName;
116 * Returns the last name.
118 * @return The last name
120 public String getLastName() {
125 * Sets the last name.
128 * The last name to set
130 public void setLastName(String lastName) {
131 modified |= ((lastName != null) && (!lastName.equals(this.lastName))) || (this.lastName != null);
132 this.lastName = lastName;