diff src/main/java/nl/cwi/monetdb/jdbc/MonetWrapper.java @ 262:2d62ca1f758b

Moved utility method newSQLFeatureNotSupportedException(String name) from MonetPreparedStatement.java and MonetResultSet.java to class MonetWrapper such that it can be called directly from all classes which extend MonetWrapper. Call MonetWrapper.newSQLFeatureNotSupportedException() from more classes and places. Update java documentation: - add "@throws SQLFeatureNotSupportedException" to methods which can throw it - remove "@throws SQLFeatureNotSupportedException" from methods which do not throw it
author Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
date Thu, 03 Jan 2019 18:33:25 +0100 (2019-01-03)
parents d4baf8a4b43a
children 003ae6d881db
line wrap: on
line diff
--- a/src/main/java/nl/cwi/monetdb/jdbc/MonetWrapper.java
+++ b/src/main/java/nl/cwi/monetdb/jdbc/MonetWrapper.java
@@ -9,6 +9,7 @@
 package nl.cwi.monetdb.jdbc;
 
 import java.sql.SQLException;
+import java.sql.SQLFeatureNotSupportedException;
 
 /**
  * A Wrapper class which provide the ability to retrieve the delegate instance
@@ -75,4 +76,16 @@ public class MonetWrapper implements jav
 		}
 		throw new SQLException("Cannot unwrap to interface: " + (iface != null ? iface.getName() : ""), "0A000");
 	}
+
+	/**
+	 * Small helper method that formats the "Method ... not implemented" message
+	 * and creates a new SQLFeatureNotSupportedException object
+	 * whose SQLState is set to "0A000": feature not supported.
+	 *
+	 * @param name the method name
+	 * @return a new created SQLFeatureNotSupportedException object with SQLState 0A000
+	 */
+	static final SQLFeatureNotSupportedException newSQLFeatureNotSupportedException(String name) {
+		return new SQLFeatureNotSupportedException("Method " + name + " not implemented", "0A000");
+	}
 }