From 9d8c6c00392246cdbefad227da05f814909ca30a Mon Sep 17 00:00:00 2001 From: DreadMoirai Date: Fri, 14 Jul 2017 15:10:51 -0700 Subject: [PATCH] removed bad import --- Samurai7.iml | 2 +- build.gradle | 14 ++++++------ .../samurai7/database/Database.java | 22 ++++++++----------- 3 files changed, 17 insertions(+), 21 deletions(-) diff --git a/Samurai7.iml b/Samurai7.iml index fb46da68..66569821 100644 --- a/Samurai7.iml +++ b/Samurai7.iml @@ -1,5 +1,5 @@ - + diff --git a/build.gradle b/build.gradle index 60739a94..b837cbd3 100644 --- a/build.gradle +++ b/build.gradle @@ -7,7 +7,7 @@ plugins { } group 'com.github.breadmoirai' -version '0.2_ALPHA' +version '0.2.1_ALPHA' sourceCompatibility = 1.8 @@ -53,11 +53,11 @@ task sourcesJar(type: Jar, dependsOn: classes) { } task jarMake{ - doLast { - print ':jarMake Creating Jars..' - jar - sourcesJar - javadocJar - shadowJar + doFirst { + println ':jarMake Creating Jars..' } + dependsOn jar + dependsOn sourcesJar + dependsOn javadocJar + dependsOn shadowJar } \ No newline at end of file diff --git a/src/main/java/com/github/breadmoirai/samurai7/database/Database.java b/src/main/java/com/github/breadmoirai/samurai7/database/Database.java index 3be28cdd..7a4be89a 100644 --- a/src/main/java/com/github/breadmoirai/samurai7/database/Database.java +++ b/src/main/java/com/github/breadmoirai/samurai7/database/Database.java @@ -15,14 +15,13 @@ */ package com.github.breadmoirai.samurai7.database; -import jdk.management.resource.ResourceId; import org.jdbi.v3.core.ConnectionFactory; import org.jdbi.v3.core.Handle; import org.jdbi.v3.core.Jdbi; -import javax.sql.DataSource; -import java.sql.*; -import java.util.Arrays; +import java.sql.DatabaseMetaData; +import java.sql.ResultSet; +import java.sql.SQLException; import java.util.function.Consumer; import java.util.function.Function; @@ -32,14 +31,11 @@ */ public class Database { - private static final String PROTOCOL = "jdbc:derby:"; - private static final String DB_NAME = "SamuraiDatabase"; - - private static Database INSTANCE; + private static Database instance; public static Database get() { - if (INSTANCE == null) throw new NullPointerException("Database has not been created."); - return INSTANCE; + if (instance == null) throw new NullPointerException("Database has not been created."); + return instance; } private final Jdbi jdbi; @@ -48,16 +44,16 @@ public static Database get() { * Supply a connection to a database. *

* This can be used with a lambda expression as such: - * *

+     * 
      * {@link com.github.breadmoirai.samurai7.database.Database}.create(() -> {@link java.sql.DriverManager}.{@link java.sql.DriverManager#getConnection(String) getConnection}("jdbc:derby:myDB;create=true"))
-     * 
* + * * * @param connectionFactory This is equivalent to a {@link java.util.function.Supplier Supplier}{@literal } */ public static void create(ConnectionFactory connectionFactory) { - INSTANCE = new Database(Jdbi.create(connectionFactory)); + instance = new Database(Jdbi.create(connectionFactory)); } private Database(Jdbi jdbi) {