com.aceql.jdbc.commons.main.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-jdbc-driver Show documentation
Show all versions of aceql-http-client-jdbc-driver Show documentation
The AceQL Java Client JDBC Driver allows to wrap the AceQL HTTP APIs and eliminates 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.
The newest version!
/*
* This file is part of AceQL JDBC Driver.
* AceQL JDBC Driver: Remote JDBC access over HTTP with AceQL HTTP.
* Copyright (c) 2023, KawanSoft SAS
* (http://www.kawansoft.com). All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.aceql.jdbc.commons.main.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;
public static final String DRIVER_PRO_REFLECTION_PACKAGE = "com.aceql.jdbc.pro.main.reflection";
/**
* 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