P15GEN2\59518
2024-05-29 d4210c7c4b04abde20037ea8aa0f54ef8a2649aa
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
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;
    }
 
}