fix
Helius
2021-08-05 8bbb027dc36b3f3c7f2d505fc75180261fb4d640
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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
package com.xzx.gc.model;
 
import com.xzx.gc.model.dto.LazyEntity;
 
import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
 
public class TailBean implements Tail {
    protected Map<String, Object> extMap = new HashMap();
    boolean hasLazy = false;
 
    public TailBean() {
    }
    @Override
    public Object get(String key) {
        if (this.hasLazy) {
            Object o = this.extMap.get(key);
            if (o instanceof LazyEntity) {
                LazyEntity lazyEntity = (LazyEntity)o;
 
                try {
                    Object real = lazyEntity.get();
                    this.extMap.put(key, real);
                    return real;
                } catch (RuntimeException var5) {
                    throw new MiException(ExceptionEnum.MONITOR_EXCEPTION);
 
                    //throw new BeetlSQLException(17, "Lazy Load Error:" + key + "," + var5.getMessage(), var5);
                }
            } else {
                return o;
            }
        } else {
            return this.extMap.get(key);
        }
    }
    @Override
    public void set(String key, Object value) {
        if (value instanceof LazyEntity) {
            this.hasLazy = true;
        }
 
        this.extMap.put(key, value);
    }
 
    public Map<String, Object> getTails() {
        Map<String, Object> newExtMap = new HashMap();
        if (this.hasLazy) {
            Iterator var2 = this.extMap.entrySet().iterator();
 
            while(var2.hasNext()) {
                Map.Entry<String, Object> entry = (Map.Entry)var2.next();
                String key = (String)entry.getKey();
                Object value = entry.getValue();
                if (value instanceof LazyEntity) {
                    try {
                        LazyEntity lazyEntity = (LazyEntity)value;
                        Object real = lazyEntity.get();
                        newExtMap.put(key, real);
                    } catch (RuntimeException var8) {
                        throw new MiException(ExceptionEnum.MONITOR_EXCEPTION);
                        //throw new BeetlSQLException(17, "Lazy Load Error:" + key + "," + var8.getMessage(), var8);
                    }
                } else {
                    newExtMap.put(key, value);
                }
            }
 
            this.extMap = newExtMap;
            this.hasLazy = false;
        }
 
        return this.extMap;
    }
}