src.main.java.com.aceql.client.jdbc.util.SimpleClassCaller Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of aceql-http-client-sdk Show documentation
Show all versions of aceql-http-client-sdk Show documentation
The AceQL Java Client SDK allows to wrap the AceQL HTTP APIs and eliminate the tedious works of handling communications errors and parsing JSON results.
Android and Java Desktop application developers can access remote SQL databases and/or SQL databases in the cloud by simply including standard JDBC calls in their code, just like they would for a local database.
/**
*
*/
package com.aceql.client.jdbc.util;
import java.lang.reflect.Constructor;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.util.List;
import java.util.Objects;
/**
* Allows to call using Reflection a simple class that has a void constructor.
*
* @author Nicolas de Pomereu
*
*/
public class SimpleClassCaller {
private String className;
/**
* Constructor.
*
* @param className full name of class to call.
*/
public SimpleClassCaller(String className) throws ClassNotFoundException {
this.className = Objects.requireNonNull(className, "className can not be null!");
}
/**
* Calls the specified method with a List of parameters types as Class> and
* List of parameter values Object.
*
* @param methodName the method name to class
* @param methodParameterTypes the List of parameter types as each element of
* Class> instance
* @param methodParameterValues the List of parameter values as each element of
* Object instance
* @return the result of the call as an Object that requires to be cast.
* @throws ClassNotFoundException
* @throws NoSuchMethodException
* @throws SecurityException
* @throws InstantiationException
* @throws IllegalAccessException
* @throws IllegalArgumentException
* @throws InvocationTargetException
*/
public Object callMehod(String methodName, List> methodParameterTypes, List