public class OperateResult extends Object
| 构造器和说明 |
|---|
OperateResult()
默认的无参构造方法
|
OperateResult(int err,
String msg)
使用指定的错误号和消息实例化默认的对象
|
OperateResult(String msg)
使用指定的消息实例化默认的对象
|
| 限定符和类型 | 方法和说明 |
|---|---|
<T> OperateResultExOne<T> |
Convert(T content)
将当前的结果对象转换到指定泛型的结果类对象,如果当前结果为失败,则返回指定泛型的失败结果类对象
Convert the current result object to the result class object of the specified generic type, if the current result is a failure, then return the result class object of the specified generic type failure |
<T1,T2> OperateResultExTwo<T1,T2> |
Convert(T1 content1,
T2 content2)
将当前的结果对象转换到指定泛型的结果类对象,如果当前结果为失败,则返回指定泛型的失败结果类对象
Convert the current result object to the result class object of the specified generic type, if the current result is a failure, then return the result class object of the specified generic type failure |
<T1,T2,T3> OperateResultExThree<T1,T2,T3> |
Convert(T1 content1,
T2 content2,
T3 content3)
将当前的结果对象转换到指定泛型的结果类对象,如果当前结果为失败,则返回指定泛型的失败结果类对象
Convert the current result object to the result class object of the specified generic type, if the current result is a failure, then return the result class object of the specified generic type failure |
<T1,T2,T3,T4> |
Convert(T1 content1,
T2 content2,
T3 content3,
T4 content4)
将当前的结果对象转换到指定泛型的结果类对象,如果当前结果为失败,则返回指定泛型的失败结果类对象
Convert the current result object to the result class object of the specified generic type, if the current result is a failure, then return the result class object of the specified generic type failure |
void |
CopyErrorFromOther(OperateResult result)
从另一个结果类中拷贝错误信息
|
static OperateResult |
CreateSuccessResult()
创建一个成功的结果类对象
|
OperateResult |
Then(FunctionOperate<OperateResult> func)
指定接下来要做的是内容,当前对象如果成功,就返回接下来的执行结果,如果失败,就返回当前对象本身。
|
<T1,T2,T3,T4> |
ThenExFour(FunctionOperate<OperateResultExFour<T1,T2,T3,T4>> func)
指定接下来要做的是内容,当前对象如果成功,就返回接下来的执行结果,如果失败,就返回当前对象本身。
|
<T> OperateResultExOne<T> |
ThenExOne(FunctionOperate<OperateResultExOne<T>> func)
指定接下来要做的是内容,当前对象如果成功,就返回接下来的执行结果,如果失败,就返回当前对象本身。
|
<T1,T2,T3> OperateResultExThree<T1,T2,T3> |
ThenExThree(FunctionOperate<OperateResultExThree<T1,T2,T3>> func)
指定接下来要做的是内容,当前对象如果成功,就返回接下来的执行结果,如果失败,就返回当前对象本身。
|
<T1,T2> OperateResultExTwo<T1,T2> |
ThenExTwo(FunctionOperate<OperateResultExTwo<T1,T2>> func)
指定接下来要做的是内容,当前对象如果成功,就返回接下来的执行结果,如果失败,就返回当前对象本身。
|
String |
ToMessageShowString() |
public boolean IsSuccess
public String Message
public int ErrorCode
public OperateResult()
public OperateResult(String msg)
msg - 错误的消息public OperateResult(int err,
String msg)
err - 错误码msg - 错误消息public String ToMessageShowString()
public void CopyErrorFromOther(OperateResult result)
result - 支持结果类及派生类public static OperateResult CreateSuccessResult()
public <T> OperateResultExOne<T> Convert(T content)
T - 结果类型content - 如果操作成功将赋予的结果内容public <T1,T2> OperateResultExTwo<T1,T2> Convert(T1 content1, T2 content2)
T1 - 泛型参数一T2 - 泛型参数二content1 - 如果操作成功将赋予的结果内容一content2 - 如果操作成功将赋予的结果内容二public <T1,T2,T3> OperateResultExThree<T1,T2,T3> Convert(T1 content1, T2 content2, T3 content3)
T1 - 泛型参数一T2 - 泛型参数二T3 - 泛型参数三content1 - 如果操作成功将赋予的结果内容一content2 - 如果操作成功将赋予的结果内容二content3 - 如果操作成功将赋予的结果内容三public <T1,T2,T3,T4> OperateResultExFour<T1,T2,T3,T4> Convert(T1 content1, T2 content2, T3 content3, T4 content4)
T1 - 泛型参数一T2 - 泛型参数二T3 - 泛型参数三T4 - 泛型参数四content1 - 如果操作成功将赋予的结果内容一content2 - 如果操作成功将赋予的结果内容二content3 - 如果操作成功将赋予的结果内容三content4 - 如果操作成功将赋予的结果内容四public OperateResult Then(FunctionOperate<OperateResult> func)
func - 等待当前对象成功后执行的内容public <T> OperateResultExOne<T> ThenExOne(FunctionOperate<OperateResultExOne<T>> func)
T - 泛型参数func - 等待当前对象成功后执行的内容public <T1,T2> OperateResultExTwo<T1,T2> ThenExTwo(FunctionOperate<OperateResultExTwo<T1,T2>> func)
T1 - 泛型参数一T2 - 泛型参数二func - 等待当前对象成功后执行的内容public <T1,T2,T3> OperateResultExThree<T1,T2,T3> ThenExThree(FunctionOperate<OperateResultExThree<T1,T2,T3>> func)
T1 - 泛型参数一T2 - 泛型参数二T3 - 泛型参数三func - 等待当前对象成功后执行的内容public <T1,T2,T3,T4> OperateResultExFour<T1,T2,T3,T4> ThenExFour(FunctionOperate<OperateResultExFour<T1,T2,T3,T4>> func)
T1 - 泛型参数一T2 - 泛型参数二T3 - 泛型参数三T4 - 泛型参数四func - 等待当前对象成功后执行的内容Copyright © 2022. All rights reserved.