1 package net.pterodactylus.sone.data.impl;
3 import static com.google.common.base.Preconditions.checkState;
5 import net.pterodactylus.sone.database.SoneBuilder;
6 import net.pterodactylus.sone.freenet.wot.Identity;
7 import net.pterodactylus.sone.freenet.wot.OwnIdentity;
10 * Abstract {@link SoneBuilder} implementation.
12 public abstract class AbstractSoneBuilder implements SoneBuilder {
14 protected Identity identity;
15 protected boolean local;
18 public SoneBuilder from(Identity identity) {
19 this.identity = identity;
24 public SoneBuilder local() {
29 protected void validate() throws IllegalStateException {
30 checkState(identity != null, "identity must not be null");
31 checkState(!local || (identity instanceof OwnIdentity),
32 "can not create local Sone from remote identity");