yangys
2024-03-31 2969df3e404db3cd116f27db1495e523ce05bf86
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
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
package com.qianwen.core.tool.metadata;
 
import java.util.function.Consumer;
import com.qianwen.core.tool.utils.StringPool;
 
/* loaded from: blade-core-tool-9.3.0.0-SNAPSHOT.jar:org/springblade/core/tool/metadata/ValidateResult.class */
public class ValidateResult {
    private boolean success;
    private Object value;
    private String errorMsg;
 
    public void setSuccess(final boolean success) {
        this.success = success;
    }
 
    public void setValue(final Object value) {
        this.value = value;
    }
 
    public void setErrorMsg(final String errorMsg) {
        this.errorMsg = errorMsg;
    }
 
    public boolean equals(final Object o) {
        if (o == this) {
            return true;
        }
        if (o instanceof ValidateResult) {
            ValidateResult other = (ValidateResult) o;
            if (other.canEqual(this) && isSuccess() == other.isSuccess()) {
                Object this$value = getValue();
                Object other$value = other.getValue();
                if (this$value == null) {
                    if (other$value != null) {
                        return false;
                    }
                } else if (!this$value.equals(other$value)) {
                    return false;
                }
                Object this$errorMsg = getErrorMsg();
                Object other$errorMsg = other.getErrorMsg();
                return this$errorMsg == null ? other$errorMsg == null : this$errorMsg.equals(other$errorMsg);
            }
            return false;
        }
        return false;
    }
 
    protected boolean canEqual(final Object other) {
        return other instanceof ValidateResult;
    }
 
    public int hashCode() {
        int result = (1 * 59) + (isSuccess() ? 79 : 97);
        Object $value = getValue();
        int result2 = (result * 59) + ($value == null ? 43 : $value.hashCode());
        Object $errorMsg = getErrorMsg();
        return (result2 * 59) + ($errorMsg == null ? 43 : $errorMsg.hashCode());
    }
 
    public String toString() {
        return "ValidateResult(success=" + isSuccess() + ", value=" + getValue() + ", errorMsg=" + getErrorMsg() + StringPool.RIGHT_BRACKET;
    }
 
    public ValidateResult(final boolean success, final Object value, final String errorMsg) {
        this.success = success;
        this.value = value;
        this.errorMsg = errorMsg;
    }
 
    /* loaded from: blade-core-tool-9.3.0.0-SNAPSHOT.jar:org/springblade/core/tool/metadata/ValidateResult$ValidateResultBuilder.class */
    public static class ValidateResultBuilder {
        private boolean success;
        private Object value;
        private String errorMsg;
 
        ValidateResultBuilder() {
        }
 
        public ValidateResultBuilder success(final boolean success) {
            this.success = success;
            return this;
        }
 
        public ValidateResultBuilder value(final Object value) {
            this.value = value;
            return this;
        }
 
        public ValidateResultBuilder errorMsg(final String errorMsg) {
            this.errorMsg = errorMsg;
            return this;
        }
 
        public ValidateResult build() {
            return new ValidateResult(this.success, this.value, this.errorMsg);
        }
 
        public String toString() {
            return "ValidateResult.ValidateResultBuilder(success=" + this.success + ", value=" + this.value + ", errorMsg=" + this.errorMsg + StringPool.RIGHT_BRACKET;
        }
    }
 
    public ValidateResult() {
    }
 
    public static ValidateResultBuilder builder() {
        return new ValidateResultBuilder();
    }
 
    public boolean isSuccess() {
        return this.success;
    }
 
    public Object getValue() {
        return this.value;
    }
 
    public String getErrorMsg() {
        return this.errorMsg;
    }
 
    public static ValidateResult success(Object value) {
        ValidateResult result = new ValidateResult();
        result.setSuccess(true);
        result.setValue(value);
        return result;
    }
 
    public static ValidateResult success() {
        ValidateResult result = new ValidateResult();
        result.setSuccess(true);
        return result;
    }
 
    public static ValidateResult fail(String message) {
        ValidateResult result = new ValidateResult();
        result.setSuccess(false);
        result.setErrorMsg(message);
        return result;
    }
 
    public Object assertSuccess() {
        if (!this.success) {
            throw new IllegalArgumentException(this.errorMsg);
        }
        return this.value;
    }
 
    public void ifFail(Consumer<ValidateResult> resultConsumer) {
        if (!this.success) {
            resultConsumer.accept(this);
        }
    }
}