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

com.smallaswater.easysql.orm.handle.ORMDynaProxyHandle Maven / Gradle / Ivy

There is a newer version: 3.0.7
Show newest version
package com.smallaswater.easysql.orm.handle;

import com.smallaswater.easysql.orm.api.IDAO;
import com.smallaswater.easysql.orm.internal.ORMInvocation;
import com.smallaswater.easysql.v3.mysql.manager.SqlManager;

import java.lang.reflect.Proxy;

/**
 * 动态代理 IDAO 操作 Entity
 * 请不要直接实例化该类
 * @param 
 */
public class ORMDynaProxyHandle> implements ORMBaseHandle {

    private final Class proxyClazz;
    private final SqlManager sqlManager;
    private final String table;

    public ORMDynaProxyHandle() {
        throw new RuntimeException("error");
    }

    public ORMDynaProxyHandle(Class proxyClazz, String table, SqlManager sqlManager) {
        this.proxyClazz = proxyClazz;
        this.sqlManager = sqlManager;
        this.table = table;
    }

    @SuppressWarnings("unchecked")
    public T getProxyInstance() {
        return (T) Proxy.newProxyInstance(proxyClazz.getClassLoader(), new Class[]{proxyClazz}, new ORMInvocation(proxyClazz, table, sqlManager));
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy