/** The Sone this profile belongs to. */
private final Sone sone;
- private volatile Name name;
+ private volatile Name name = new Name();
private volatile BirthDate birthDate = new BirthDate();
/** The ID of the avatar image. */
/**
* Sets the avatar image.
*
- * @param avatar
- * The new avatar image, or {@code null} to not select an avatar
- * image.
- * @return This Sone
+ * @param avatarId
+ * The ID of the new avatar image
+ * @return This profile
*/
- public Profile setAvatar(Image avatar) {
- if (avatar == null) {
- this.avatar = null;
- return this;
- }
- checkArgument(avatar.getSone().equals(sone), "avatar must belong to Sone");
- this.avatar = avatar.getId();
+ public Profile setAvatar(Optional<String> avatarId) {
+ this.avatar = avatarId.orNull();
return this;
}
this.id = checkNotNull(id, "id must not be null");
}
+ public Field(String id, String name, String value) {
+ this.id = checkNotNull(id, "id must not be null");
+ this.name = name;
+ this.value = value;
+ }
+
/**
* Returns the ID of this field.
*
private final Optional<String> middle;
private final Optional<String> last;
+ public Name() {
+ this(Optional.<String>absent(), Optional.<String>absent(), Optional.<String>absent());
+ }
+
public Name(Optional<String> first, Optional<String> middle, Optional<String> last) {
this.first = first;
this.middle = middle;