Example usage for javax.sql.rowset CachedRowSet getClass

List of usage examples for javax.sql.rowset CachedRowSet getClass

Introduction

In this page you can find the example usage for javax.sql.rowset CachedRowSet getClass.

Prototype

@HotSpotIntrinsicCandidate
public final native Class<?> getClass();

Source Link

Document

Returns the runtime class of this Object .

Usage

From source file:com.jaspersoft.jasperserver.util.JasperJdbcContainer.java

/**
 *  This method is a hack, using reflection invokes a private method on the CachedRowSet object to 
 *  extract the parameter payload. // w w  w .  ja  va  2 s  . com
 * @param crs CachedRowSet 
 * @return
 */
private Object[] getParameters(CachedRowSet crs) {
    Object[] params = null;
    try {
        Method method = crs.getClass().getMethod("getParams", (Class[]) null);
        method.setAccessible(true);
        params = (Object[]) method.invoke(crs, (Object[]) null);
    } catch (NoSuchMethodException e) {
        logger.error(e.getMessage(), e);
        throw new RemoteException("Can't get method name." + e.getMessage());
    } catch (SecurityException e) {
        logger.error(e.getMessage(), e);
        throw new RemoteException("Can't get method name." + e.getMessage());
    } catch (IllegalAccessException e) {
        logger.error(e.getMessage(), e);
        throw new RemoteException("Can't get method name." + e.getMessage());
    } catch (IllegalArgumentException e) {
        logger.error(e.getMessage(), e);
        throw new RemoteException("Can't get method name." + e.getMessage());
    } catch (InvocationTargetException e) {
        logger.error(e.getMessage(), e);
        throw new RemoteException("Can't get method name." + e.getMessage());
    }

    return params;

}