X-Git-Url: https://git.pterodactylus.net/?p=Sone.git;a=blobdiff_plain;f=src%2Fmain%2Fjava%2Fnet%2Fpterodactylus%2Fsone%2Fdata%2Fimpl%2FAbstractSoneBuilder.java;fp=src%2Fmain%2Fjava%2Fnet%2Fpterodactylus%2Fsone%2Fdata%2Fimpl%2FAbstractSoneBuilder.java;h=1ce38e4ed0c358384091f915b701217e04614186;hp=b7dda3f312994012ab73bb937656e1fc22a11b48;hb=3752ebf20fcb0c71287f2b7fed358b14c7649d7f;hpb=f333f58180a7f112394cd768d86c95a3c9edf794 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 b7dda3f..1ce38e4 100644 --- a/src/main/java/net/pterodactylus/sone/data/impl/AbstractSoneBuilder.java +++ b/src/main/java/net/pterodactylus/sone/data/impl/AbstractSoneBuilder.java @@ -2,6 +2,7 @@ package net.pterodactylus.sone.data.impl; import static com.google.common.base.Preconditions.checkState; +import net.pterodactylus.sone.data.Client; import net.pterodactylus.sone.database.SoneBuilder; import net.pterodactylus.sone.freenet.wot.Identity; import net.pterodactylus.sone.freenet.wot.OwnIdentity; @@ -16,6 +17,7 @@ public abstract class AbstractSoneBuilder implements SoneBuilder { protected Identity identity; protected boolean local; protected long lastUpdated; + protected Client client; @Override public SoneBuilder from(Identity identity) { @@ -35,11 +37,18 @@ public abstract class AbstractSoneBuilder implements SoneBuilder { return this; } + @Override + public SoneBuilder using(Client client) { + this.client = client; + return this; + } + 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"); } }