+ hash.putString("BirthYear(").putInt(birthYear).putString(")");
+ }
+ if (avatar != null) {
+ hash.putString("Avatar(").putString(avatar).putString(")");
+ }
+ hash.putString("ContactInformation(");
+ for (Field field : fields) {
+ hash.putString(field.getName()).putString("(").putString(field.getValue()).putString(")");
+ }
+ hash.putString(")");
+ hash.putString(")");
+
+ return hash.hash().toString();
+ }
+
+ /**
+ * Container for a profile field.
+ *
+ * @author <a href="mailto:bombe@pterodactylus.net">David ‘Bombe’ Roden</a>
+ */
+ public class Field {
+
+ /** The ID of the field. */
+ private final String id;
+
+ /** The name of the field. */
+ private String name;
+
+ /** The value of the field. */
+ private String value;
+
+ /**
+ * Creates a new field with a random ID.
+ */
+ private Field() {
+ this(UUID.randomUUID().toString());
+ }
+
+ /**
+ * Creates a new field with the given ID.
+ *
+ * @param id
+ * The ID of the field
+ */
+ private Field(@Nonnull String id) {
+ this.id = checkNotNull(id, "id must not be null");
+ }
+
+ /**
+ * Returns the ID of this field.
+ *
+ * @return The ID of this field
+ */
+ @Nonnull
+ public String getId() {
+ return id;
+ }
+
+ /**
+ * Returns the name of this field.
+ *
+ * @return The name of this field
+ */
+ @Nonnull
+ public String getName() {
+ return name;