yangys
2024-04-02 1a77b1a7c072b136925d6d73c4d8f017ca016e3a
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
77
78
79
80
81
82
83
84
85
86
87
88
89
package com.qianwen.core.tool.script.engine;
 
import java.util.function.Supplier;
import javax.script.ScriptException;
 
/* loaded from: blade-core-tool-9.3.0.0-SNAPSHOT.jar:org/springblade/core/tool/script/engine/ExecuteResult.class */
public class ExecuteResult {
    private boolean success;
    private Object result;
    private String message;
    private transient Exception exception;
    private long useTime;
 
    public boolean isSuccess() {
        return this.success;
    }
 
    public void setSuccess(boolean success) {
        this.success = success;
    }
 
    @Deprecated
    public Object getResult() {
        return this.result;
    }
 
    public void setResult(Object result) {
        this.result = result;
    }
 
    public String getMessage() {
        if (this.message == null && this.exception != null) {
            this.message = this.exception.getMessage();
        }
        return this.message;
    }
 
    public void setMessage(String message) {
        this.message = message;
    }
 
    public Exception getException() {
        return this.exception;
    }
 
    public void setException(Exception exception) {
        this.exception = exception;
    }
 
    public long getUseTime() {
        return this.useTime;
    }
 
    public void setUseTime(long useTime) {
        this.useTime = useTime;
    }
 
    public String toString() {
        return String.valueOf(getResult());
    }
 
    public Object get() {
        return this.result;
    }
 
    public Object getIfSuccess() throws Exception {
        if (!this.success) {
            if (this.exception != null) {
                throw this.exception;
            }
            throw new ScriptException(this.message);
        }
        return this.result;
    }
 
    public Object getIfSuccess(Object defaultValue) {
        if (!this.success) {
            return defaultValue;
        }
        return this.result;
    }
 
    public Object getIfSuccess(Supplier<?> supplier) {
        if (!this.success) {
            return supplier.get();
        }
        return this.result;
    }
}