Package org.shoulder.log.operation.enums
Enum OperationResult
- All Implemented Interfaces:
Serializable,Comparable<OperationResult>,java.lang.constant.Constable
业务操作结果:
成功或失败:1表示成功,0表示失败,2表示部分成功;
正确或不正确:1表示正确,0表示不正确;
操作结果在一个业务中哪怕输入相同结果也可能不确定,常用作函数参数,不在注解中出现,因此通过枚举类使用
- Author:
- lym
-
Nested Class Summary
Nested classes/interfaces inherited from class java.lang.Enum
Enum.EnumDesc<E extends Enum<E>> -
Enum Constant Summary
Enum Constants -
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptionintgetCode()static OperationResultof(boolean success) static OperationResultof(boolean hasSuccess, boolean hasFail) 如果 hasSuccess、hasFail 都为 false 则默认为操作成功static OperationResultof(Collection<? extends OperateResult> results) 如果操作结果为空默认为成功static OperationResultReturns the enum constant of this type with the specified name.static OperationResult[]values()Returns an array containing the constants of this enum type, in the order they are declared.
-
Enum Constant Details
-
SUCCESS
成功 | 正确 -
FAIL
失败 | 不正确 -
PARTIAL
部分成功(适用于批量操作,如批量保存10条数据,5条成功,5条失败)
-
-
Field Details
-
code
public final int code
-
-
Method Details
-
values
Returns an array containing the constants of this enum type, in the order they are declared.- Returns:
- an array containing the constants of this enum type, in the order they are declared
-
valueOf
Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)- Parameters:
name- the name of the enum constant to be returned.- Returns:
- the enum constant with the specified name
- Throws:
IllegalArgumentException- if this enum type has no constant with the specified nameNullPointerException- if the argument is null
-
of
-
of
如果 hasSuccess、hasFail 都为 false 则默认为操作成功 -
of
如果操作结果为空默认为成功 -
getCode
public int getCode()
-