7c135cecb6293e657fcc207994b9d503da49b731
[Sone.git] / src / main / java / net / pterodactylus / sone / database / memory / MemorySoneBuilder.java
1 package net.pterodactylus.sone.database.memory;
2
3 import net.pterodactylus.sone.data.Sone;
4 import net.pterodactylus.sone.data.impl.SoneImpl;
5 import net.pterodactylus.sone.data.impl.AbstractSoneBuilder;
6 import net.pterodactylus.sone.database.Database;
7
8 /**
9  * Memory-based {@link AbstractSoneBuilder} implementation.
10  *
11  * @author <a href="mailto:bombe@pterodactylus.net">David ‘Bombe’ Roden</a>
12  */
13 public class MemorySoneBuilder extends AbstractSoneBuilder {
14
15         private final Database database;
16
17         public MemorySoneBuilder(Database database) {
18                 this.database = database;
19         }
20
21         @Override
22         public Sone build() throws IllegalStateException {
23                 validate();
24                 return new SoneImpl(database, identity, local, lastUpdated);
25         }
26
27 }