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 * @author <a href="mailto:bombe@pterodactylus.net">David ‘Bombe’ Roden</a>
14 public abstract class AbstractSoneBuilder implements SoneBuilder {
16 protected Identity identity;
17 protected boolean local;
20 public SoneBuilder from(Identity identity) {
21 this.identity = identity;
26 public SoneBuilder local() {
31 protected void validate() throws IllegalStateException {
32 checkState(identity != null, "identity must not be null");
33 checkState(!local || (identity instanceof OwnIdentity),
34 "can not create local Sone from remote identity");