return new MSqlConnection(this.getDriver(), this.getUrl(), this.getUsername(), this.getPassword());
}
+ public boolean isGeneratorFor(MSqlConnection connection) {
+ if (null == connection) {
+ throw new IllegalArgumentException("Invalid 'connection': null.");
+ }
+ //
+ if (!connection.getDriver().equals(this.getDriver())) {
+ return false;
+ }
+ if (!connection.getUrl().equals(this.getUrl())) {
+ return false;
+ }
+ if (!connection.getUsername().equals(this.getUsername())) {
+ return false;
+ }
+ if (!connection.getPassword().equals(this.getPassword())) {
+ return false;
+ }
+ //
+ return true;
+ }
+
}
if (null == connection) {
throw new IllegalArgumentException("Invalid 'connection': null.");
}
+ else if (!this.getConnectionGenerator().isGeneratorFor(connection)) {
+ throw new IllegalArgumentException("Invalid 'connection': not generated by this connection generator.");
+ }
else if (connection.isClosed()) {
throw new IllegalArgumentException("Invalid 'connection': closed.");
}