From: David ‘Bombe’ Roden Date: Thu, 19 Apr 2012 14:28:58 +0000 (+0200) Subject: Add object creator for lazy artists. X-Git-Url: https://git.pterodactylus.net/?a=commitdiff_plain;h=107b958b2ea77694ead63535858f39ab107895e9;p=demoscenemusic.git Add object creator for lazy artists. --- diff --git a/src/main/java/net/pterodactylus/demoscenemusic/data/DataManager.java b/src/main/java/net/pterodactylus/demoscenemusic/data/DataManager.java index 7e74ea9..a3af13c 100644 --- a/src/main/java/net/pterodactylus/demoscenemusic/data/DataManager.java +++ b/src/main/java/net/pterodactylus/demoscenemusic/data/DataManager.java @@ -31,6 +31,7 @@ import net.pterodactylus.util.database.DatabaseException; import net.pterodactylus.util.database.Field; import net.pterodactylus.util.database.Join; import net.pterodactylus.util.database.Join.JoinType; +import net.pterodactylus.util.database.ObjectCreator; import net.pterodactylus.util.database.OrderField; import net.pterodactylus.util.database.OrderField.Order; import net.pterodactylus.util.database.Parameter.StringParameter; @@ -47,6 +48,8 @@ import net.pterodactylus.util.database.ValueFieldWhereClause; */ public class DataManager { + private final ObjectCreator artistCreator = new ArtistCreator(); + private final Database database; public DataManager(Database database) { @@ -234,4 +237,16 @@ public class DataManager { } + private class ArtistCreator implements ObjectCreator { + + /** + * {@inheritDoc} + */ + @Override + public Artist createObject(ResultSet resultSet) throws SQLException { + return new LazyArtist(resultSet.getString("ARTISTS.ID")).name(resultSet.getString("ARTISTS.NAME")); + } + + } + }