hefeixia
2021-02-18 5b8c95c760840f09910730943b21391e47187315
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 frame.persist.loader;
 
import java.math.BigDecimal;
import java.sql.ResultSet;
import java.util.Date;
 
import frame.persist.ILoadable;
import frame.variant.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;
    }
 
}