import static com.google.common.base.Preconditions.checkNotNull;
import static com.google.common.base.Preconditions.checkState;
+import static java.util.UUID.randomUUID;
import net.pterodactylus.sone.data.Album;
import net.pterodactylus.sone.data.Sone;
// PROTECTED METHODS
//
+ protected String getId() {
+ return randomId ? randomUUID().toString() : id;
+ }
+
+ protected long getCreationTime() {
+ return createdNow ? System.currentTimeMillis() : creationTime;
+ }
+
/**
* Validates the state of this image builder.
*
package net.pterodactylus.sone.data.impl;
-import static java.util.UUID.randomUUID;
-
import net.pterodactylus.sone.data.Album;
import net.pterodactylus.sone.data.Image;
import net.pterodactylus.sone.data.ImageImpl;
@Override
public Image build() throws IllegalStateException {
validate();
- String id = randomId ? randomUUID().toString() : this.id;
- long creationTime = createdNow ? System.currentTimeMillis() : this.creationTime;
- return new ImageImpl(id, sone, album, key, creationTime, width, height);
+ return new ImageImpl(getId(), sone, album, key, getCreationTime(), width, height);
}
}