com.databricks.jdbc.commons.util.WrapperUtil Maven / Gradle / Ivy
package com.databricks.jdbc.commons.util;
import com.databricks.jdbc.core.DatabricksSQLException;
import java.sql.SQLException;
public class WrapperUtil {
public static boolean isWrapperFor(Class> iface, Object object) {
return iface.isInstance(object);
}
public static T unwrap(Class iface, Object object) throws SQLException {
try {
return iface.cast(object);
} catch (Exception exception) {
throw new DatabricksSQLException("Cannot unwrap object to class", exception);
}
}
}