X-Git-Url: https://git.pterodactylus.net/?p=Sone.git;a=blobdiff_plain;f=src%2Fmain%2Fjava%2Fnet%2Fpterodactylus%2Fsone%2Fdata%2Fimpl%2FAbstractSoneBuilder.java;h=5ec8ec4244933d5aea7025820909bbc280c87442;hp=a2f1333123ddcca6c743d3ac5b9d3aaf54c5a95f;hb=f8672b1385173a103d7f085d8e9cd43bc5762d71;hpb=79c49c4bf6b1fef8b6696ca9e5ba615e1996f5e6 diff --git a/src/main/java/net/pterodactylus/sone/data/impl/AbstractSoneBuilder.java b/src/main/java/net/pterodactylus/sone/data/impl/AbstractSoneBuilder.java index a2f1333..5ec8ec4 100644 --- a/src/main/java/net/pterodactylus/sone/data/impl/AbstractSoneBuilder.java +++ b/src/main/java/net/pterodactylus/sone/data/impl/AbstractSoneBuilder.java @@ -20,7 +20,6 @@ import net.pterodactylus.sone.freenet.wot.OwnIdentity; public abstract class AbstractSoneBuilder implements SoneBuilder { protected Identity identity; - protected boolean local; protected long lastUpdated; protected Client client; protected final Collection posts = new HashSet(); @@ -33,12 +32,6 @@ public abstract class AbstractSoneBuilder implements SoneBuilder { } @Override - public SoneBuilder local() { - this.local = true; - return this; - } - - @Override public SoneBuilder lastUpdated(long lastUpdated) { this.lastUpdated = lastUpdated; return this; @@ -66,10 +59,14 @@ public abstract class AbstractSoneBuilder implements SoneBuilder { protected void validate() throws IllegalStateException { checkState(identity != null, "identity must not be null"); - checkState(!local || (identity instanceof OwnIdentity), - "can not create local Sone from remote identity"); checkState(lastUpdated > 0, "last update time must be set"); checkState(client != null, "client must not be null"); } + protected void validateLocal() throws IllegalStateException { + validate(); + checkState(identity instanceof OwnIdentity, + "identity must be an own identity for a local Sone"); + } + }