*
* @author <a href="mailto:bombe@pterodactylus.net">David ‘Bombe’ Roden</a>
*/
-public class Profile {
+public class Profile implements Fingerprintable {
/** Whether the profile was modified. */
private volatile boolean modified;
return this;
}
+ //
+ // INTERFACE Fingerprintable
+ //
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public String getFingerprint() {
+ StringBuilder fingerprint = new StringBuilder();
+ fingerprint.append("Profile(");
+ if (firstName != null) {
+ fingerprint.append("FirstName(").append(firstName).append(')');
+ }
+ if (middleName != null) {
+ fingerprint.append("MiddleName(").append(middleName).append(')');
+ }
+ if (lastName != null) {
+ fingerprint.append("LastName(").append(lastName).append(')');
+ }
+ if (birthDay != null) {
+ fingerprint.append("BirthDay(").append(birthDay).append(')');
+ }
+ if (birthMonth != null) {
+ fingerprint.append("BirthMonth(").append(birthMonth).append(')');
+ }
+ if (birthYear != null) {
+ fingerprint.append("BirthYear(").append(birthYear).append(')');
+ }
+ fingerprint.append(")");
+
+ return fingerprint.toString();
+ }
+
}
@Override
public synchronized String getFingerprint() {
StringBuilder fingerprint = new StringBuilder();
- fingerprint.append("Profile(");
- if (profile.getFirstName() != null) {
- fingerprint.append("FirstName(").append(profile.getFirstName()).append(')');
- }
- if (profile.getMiddleName() != null) {
- fingerprint.append("MiddleName(").append(profile.getMiddleName()).append(')');
- }
- if (profile.getLastName() != null) {
- fingerprint.append("LastName(").append(profile.getLastName()).append(')');
- }
- if (profile.getBirthDay() != null) {
- fingerprint.append("BirthDay(").append(profile.getBirthDay()).append(')');
- }
- if (profile.getBirthMonth() != null) {
- fingerprint.append("BirthMonth(").append(profile.getBirthMonth()).append(')');
- }
- if (profile.getBirthYear() != null) {
- fingerprint.append("BirthYear(").append(profile.getBirthYear()).append(')');
- }
- fingerprint.append(")");
+ fingerprint.append(profile.getFingerprint());
fingerprint.append("Posts(");
for (Post post : getPosts()) {