Add object creator for lazy artists.
authorDavid ‘Bombe’ Roden <bombe@pterodactylus.net>
Thu, 19 Apr 2012 14:28:58 +0000 (16:28 +0200)
committerDavid ‘Bombe’ Roden <bombe@pterodactylus.net>
Thu, 19 Apr 2012 14:28:58 +0000 (16:28 +0200)
src/main/java/net/pterodactylus/demoscenemusic/data/DataManager.java

index 7e74ea9..a3af13c 100644 (file)
@@ -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<Artist> artistCreator = new ArtistCreator();
+
        private final Database database;
 
        public DataManager(Database database) {
@@ -234,4 +237,16 @@ public class DataManager {
 
        }
 
+       private class ArtistCreator implements ObjectCreator<Artist> {
+
+               /**
+                * {@inheritDoc}
+                */
+               @Override
+               public Artist createObject(ResultSet resultSet) throws SQLException {
+                       return new LazyArtist(resultSet.getString("ARTISTS.ID")).name(resultSet.getString("ARTISTS.NAME"));
+               }
+
+       }
+
 }