projects
/
Sone.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Remove copy method from post builder.
[Sone.git]
/
src
/
main
/
java
/
net
/
pterodactylus
/
sone
/
data
/
impl
/
AbstractImageBuilder.java
diff --git
a/src/main/java/net/pterodactylus/sone/data/impl/AbstractImageBuilder.java
b/src/main/java/net/pterodactylus/sone/data/impl/AbstractImageBuilder.java
index
1b9e3a8
..
6ccd130
100644
(file)
--- a/
src/main/java/net/pterodactylus/sone/data/impl/AbstractImageBuilder.java
+++ b/
src/main/java/net/pterodactylus/sone/data/impl/AbstractImageBuilder.java
@@
-17,8
+17,8
@@
package net.pterodactylus.sone.data.impl;
import static com.google.common.base.Preconditions.checkState;
package net.pterodactylus.sone.data.impl;
import static com.google.common.base.Preconditions.checkState;
+import static java.util.UUID.randomUUID;
-import net.pterodactylus.sone.data.Sone;
import net.pterodactylus.sone.database.ImageBuilder;
/**
import net.pterodactylus.sone.database.ImageBuilder;
/**
@@
-34,7
+34,6
@@
public abstract class AbstractImageBuilder implements ImageBuilder {
/** The ID of the album to create. */
protected String id;
/** The ID of the album to create. */
protected String id;
- protected Sone sone;
protected long creationTime;
protected boolean createdNow;
protected String key;
protected long creationTime;
protected boolean createdNow;
protected String key;
@@
-54,12
+53,6
@@
public abstract class AbstractImageBuilder implements ImageBuilder {
}
@Override
}
@Override
- public ImageBuilder by(Sone sone) {
- this.sone = sone;
- return this;
- }
-
- @Override
public ImageBuilder created(long creationTime) {
this.creationTime = creationTime;
return this;
public ImageBuilder created(long creationTime) {
this.creationTime = creationTime;
return this;
@@
-88,6
+81,14
@@
public abstract class AbstractImageBuilder implements ImageBuilder {
// PROTECTED METHODS
//
// 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.
*
/**
* Validates the state of this image builder.
*
@@
-96,7
+97,6
@@
public abstract class AbstractImageBuilder implements ImageBuilder {
*/
protected void validate() throws IllegalStateException {
checkState((randomId && (id == null)) || (!randomId && (id != null)), "exactly one of random ID or custom ID must be set");
*/
protected void validate() throws IllegalStateException {
checkState((randomId && (id == null)) || (!randomId && (id != null)), "exactly one of random ID or custom ID must be set");
- checkState(sone != null, "sone must not be null");
checkState((createdNow && (creationTime == 0)) || (!createdNow && (creationTime > 0)), "exactly one of created now or creation time must be set");
checkState((width > 0) && (height > 0), "width and height must be set");
}
checkState((createdNow && (creationTime == 0)) || (!createdNow && (creationTime > 0)), "exactly one of created now or creation time must be set");
checkState((width > 0) && (height > 0), "width and height must be set");
}