import java.util.Collection;
import java.util.HashSet;
import java.util.List;
+import java.util.concurrent.Callable;
+import net.pterodactylus.util.collection.Memoizer;
import net.pterodactylus.util.database.Database;
import net.pterodactylus.util.database.DatabaseException;
import net.pterodactylus.util.database.Field;
}
+ private class LazyArtist extends DefaultArtist {
+
+ private final Memoizer<Void> tracks = new Memoizer<Void>(new Callable<Void>() {
+ public Void call() throws DatabaseException {
+ if (!hasValue("tracks")) {
+ value("tracks", Collection.class).set(getTracksByArtist(id()));
+ }
+ return null;
+ }
+ });
+
+ public LazyArtist(String id) {
+ super(id);
+ }
+
+ public Collection<Track> tracks() {
+ tracks.get();
+ return value("tracks", Collection.class).get();
+ }
+
+ }
+
}