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

org.n3r.eql.map.EqlCallableResultBeanMapper Maven / Gradle / Ivy

There is a newer version: 0.1.19
Show newest version
package org.n3r.eql.map;

import lombok.val;
import org.n3r.eql.joor.Reflect;
import org.n3r.eql.param.EqlParamPlaceholder;

import java.sql.CallableStatement;

public class EqlCallableResultBeanMapper extends EqlBaseBeanMapper implements EqlCallableReturnMapper {
    public EqlCallableResultBeanMapper(Class mappedClass) {
        super(mappedClass);
    }

    @Override
    public Object mapResult(EqlRun eqlRun, CallableStatement cs) {
        Object mappedObject = Reflect.on(this.mappedClass).create().get();
        val callableRs = new CallableRs(cs);

        for (int i = 0, ii = eqlRun.getPlaceHolders().length; i < ii; ++i) {
            val placeholder = eqlRun.getPlaceHolders()[i];
            if (placeholder.getInOut() != EqlParamPlaceholder.InOut.IN) {
                String field = placeholder.getPlaceholder();
                setColumnValue(callableRs, mappedObject, i + 1, field);
            }
        }

        return mappedObject;
    }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy