From c7e1e8bf548d6f0b94156bf81bbf804bc8a80a1c Mon Sep 17 00:00:00 2001 From: =?utf8?q?David=20=E2=80=98Bombe=E2=80=99=20Roden?= Date: Thu, 19 Apr 2012 16:10:12 +0200 Subject: [PATCH] Add object creator for groups. --- .../demoscenemusic/data/DefaultGroup.java | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/src/main/java/net/pterodactylus/demoscenemusic/data/DefaultGroup.java b/src/main/java/net/pterodactylus/demoscenemusic/data/DefaultGroup.java index 08fddf4..38ababe 100644 --- a/src/main/java/net/pterodactylus/demoscenemusic/data/DefaultGroup.java +++ b/src/main/java/net/pterodactylus/demoscenemusic/data/DefaultGroup.java @@ -17,6 +17,11 @@ package net.pterodactylus.demoscenemusic.data; +import java.sql.ResultSet; +import java.sql.SQLException; + +import net.pterodactylus.util.database.ObjectCreator; + /** * TODO * @@ -24,6 +29,8 @@ package net.pterodactylus.demoscenemusic.data; */ public class DefaultGroup extends DefaultBase implements Group { + public static final ObjectCreator CREATOR = new GroupCreator(); + public DefaultGroup(String id) { super(id); } @@ -58,4 +65,16 @@ public class DefaultGroup extends DefaultBase implements Group { return this; } + private static class GroupCreator implements ObjectCreator { + + /** + * {@inheritDoc} + */ + @Override + public Group createObject(ResultSet resultSet) throws SQLException { + return new DefaultGroup(resultSet.getString("GROUPS.ID")).name(resultSet.getString("GROUPS.NAME")).url(resultSet.getString("GROUPS.URL")); + } + + } + } -- 2.7.4