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

com.codingapi.springboot.framework.domain.proxy.DomainProxyFactory Maven / Gradle / Ivy

There is a newer version: 3.3.12
Show newest version
package com.codingapi.springboot.framework.domain.proxy;

import com.codingapi.springboot.framework.domain.event.DomainCreateEvent;
import com.codingapi.springboot.framework.event.EventPusher;

import java.lang.reflect.InvocationTargetException;

/**
 * 实体代理工厂
 */
public class DomainProxyFactory {

    @SuppressWarnings("unchecked")
    public static  T create(Class entityClass, Object... args) {
        DomainChangeInterceptor interceptor = null;
        try {
            interceptor = new DomainChangeInterceptor(entityClass, args);
        } catch (NoSuchMethodException | InvocationTargetException | InstantiationException | IllegalAccessException e) {
            throw new RuntimeException(e);
        }
        T result = (T) interceptor.createProxy();
        EventPusher.push(new DomainCreateEvent(result));
        return result;
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy