package foundation.data.getter;
|
|
import java.math.BigDecimal;
|
import java.sql.ResultSet;
|
import java.util.Date;
|
|
import foundation.persist.ILoadable;
|
import foundation.translator.Translator;
|
|
|
public class ValueLoader implements ILoadable {
|
|
private Object object;
|
|
public ValueLoader() {
|
|
}
|
|
@Override
|
public void load(ResultSet rslt, Object... args) throws Exception {
|
if (rslt.next()) {
|
object = rslt.getObject(1);
|
}
|
}
|
|
public int getInt() throws Exception {
|
if (object == null) {
|
return 0;
|
}
|
|
return Translator.toInteger(object, 0);
|
}
|
|
public String getString() throws Exception {
|
return Translator.toString(object);
|
}
|
|
public BigDecimal getBigDecimal() throws Exception {
|
return Translator.toBigDecimal(object);
|
}
|
|
public Date getDate() throws Exception {
|
return Translator.toDate(object);
|
}
|
|
public Object getObject() {
|
return object;
|
}
|
|
}
|