com.ninja_squad.dbsetup.destination
Class DriverManagerDestination

java.lang.Object
  extended by com.ninja_squad.dbsetup.destination.DriverManagerDestination
All Implemented Interfaces:
Destination

@Immutable
public final class DriverManagerDestination
extends java.lang.Object
implements Destination

A destination which uses the DriverManager to get a connection


Constructor Summary
DriverManagerDestination(java.lang.String url, java.lang.String user, java.lang.String password)
          Constructor
 
Method Summary
 boolean equals(java.lang.Object obj)
           
 java.sql.Connection getConnection()
          Returns a connection to the destination database
 int hashCode()
           
 java.lang.String toString()
           
static DriverManagerDestination with(java.lang.String url, java.lang.String user, java.lang.String password)
          Factory method creating a new DriverManagerDestination.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

DriverManagerDestination

public DriverManagerDestination(@Nonnull
                                java.lang.String url,
                                java.lang.String user,
                                java.lang.String password)
Constructor

Parameters:
url - the URL of the database
user - the user used to get a connection
password - the password used to get a connection
Method Detail

with

public static DriverManagerDestination with(@Nonnull
                                            java.lang.String url,
                                            java.lang.String user,
                                            java.lang.String password)
Factory method creating a new DriverManagerDestination. This allows a more readable style than using the constructor:
    DbSetup dbSetup = new DbSetup(DriverManagerDestination.with(url, user, password), operation);
 
or, if this method is statically imported:
    DbSetup dbSetup = new DbSetup(with(url, user, password), operation);
 
instead of
    DbSetup dbSetup = new DbSetup(new DriverManagerDestination(url, user, password), operation);
 

Parameters:
url - the URL of the database
user - the user used to get a connection
password - the password used to get a connection

getConnection

public java.sql.Connection getConnection()
                                  throws java.sql.SQLException
Description copied from interface: Destination
Returns a connection to the destination database

Specified by:
getConnection in interface Destination
Returns:
a connection to the destination database
Throws:
java.sql.SQLException - if a connection can't be returned

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

hashCode

public int hashCode()
Overrides:
hashCode in class java.lang.Object

equals

public boolean equals(java.lang.Object obj)
Overrides:
equals in class java.lang.Object