All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.github.chengyuxing.sql.utils.XQLMapperUtil Maven / Gradle / Ivy

Go to download

Light wrapper of JDBC, support ddl, dml, query, plsql/procedure/function, transaction and manage sql file.

There is a newer version: 9.0.2
Show newest version
package com.github.chengyuxing.sql.utils;

import com.github.chengyuxing.sql.XQLInvocationHandler;
import com.github.chengyuxing.sql.annotation.XQLMapper;

import java.lang.reflect.Proxy;

public class XQLMapperUtil {
    @SuppressWarnings("unchecked")
    public static  T getProxyInstance(Class clazz, XQLInvocationHandler xqlInvocationHandler) throws IllegalAccessException {
        if (!clazz.isInterface()) {
            throw new IllegalAccessException("Not interface: " + clazz.getName());
        }
        if (!clazz.isAnnotationPresent(XQLMapper.class)) {
            throw new IllegalAccessException(clazz + " should be annotated with @" + XQLMapper.class.getSimpleName());
        }
        return (T) Proxy.newProxyInstance(clazz.getClassLoader(), new Class[]{clazz}, xqlInvocationHandler);
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy