org.n3r.eql.map.EqlCallableResultBeanMapper Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of eql Show documentation
Show all versions of eql Show documentation
a simple wrapper framework for jdbc to seperate sql and java code
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;
}
}