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

io.github.afezeria.freedao.classic.runtime.context.ProxyContext Maven / Gradle / Ivy

package io.github.afezeria.freedao.classic.runtime.context;

import io.github.afezeria.freedao.classic.runtime.SqlSignature;

import java.util.List;

/**
 * @author afezeria
 */
public class ProxyContext extends DaoContext {
    @Override
    @SuppressWarnings("unchecked")
    public  T proxy(SqlSignature signature, Object... methodArgs) {
        Object[] sqlAndArgs = getDelegate().buildSql(signature, methodArgs, signature.getSqlBuilderClosure());
        return getDelegate().execute(
                signature,
                methodArgs,
                (String) sqlAndArgs[0],
                (List) sqlAndArgs[1],
                signature.getSqlExecutor(),
                signature.getResultHandler()
        );
    }
}