*/
package net.pterodactylus.sone.data.impl;
-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;
import net.pterodactylus.sone.database.ImageBuilder;
*/
public abstract class AbstractImageBuilder implements ImageBuilder {
- protected final Album album;
-
/** Whether to create an album with a random ID. */
protected boolean randomId;
protected int width;
protected int height;
- public AbstractImageBuilder(Album album) {
- this.album = checkNotNull(album, "album must not be null");
- }
-
@Override
public ImageBuilder randomId() {
randomId = true;
// 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.
*