Commit e267ef80 by gdj

调整枚举。

parent 65d7b4e1
...@@ -17,7 +17,13 @@ public enum TaskTypeEnum { ...@@ -17,7 +17,13 @@ public enum TaskTypeEnum {
TIMED(1), TIMED(1),
CONDITIONAL(2); CONDITIONAL(2),
/**
* 空中下发航线
*/
UNKNOWN(-1),
;
private final int type; private final int type;
...@@ -33,6 +39,6 @@ public enum TaskTypeEnum { ...@@ -33,6 +39,6 @@ public enum TaskTypeEnum {
@JsonCreator @JsonCreator
public static TaskTypeEnum find(int type) { public static TaskTypeEnum find(int type) {
return Arrays.stream(values()).filter(typeEnum -> typeEnum.type == type).findAny() return Arrays.stream(values()).filter(typeEnum -> typeEnum.type == type).findAny()
.orElseThrow(() -> new CloudSDKException(TaskTypeEnum.class, type)); .orElse(UNKNOWN);
} }
} }
...@@ -16,6 +16,8 @@ public enum ErrorCodeSourceEnum { ...@@ -16,6 +16,8 @@ public enum ErrorCodeSourceEnum {
ZERO(0), ZERO(0),
UNKNOWN(-1),
DEVICE(3), DEVICE(3),
DOCK(5), DOCK(5),
...@@ -36,6 +38,7 @@ public enum ErrorCodeSourceEnum { ...@@ -36,6 +38,7 @@ public enum ErrorCodeSourceEnum {
@JsonCreator @JsonCreator
public static ErrorCodeSourceEnum find(int source) { public static ErrorCodeSourceEnum find(int source) {
return Arrays.stream(values()).filter(error -> error.source == source).findAny() return Arrays.stream(values()).filter(error -> error.source == source).findAny()
.orElseThrow(() -> new CloudSDKException(ErrorCodeSourceEnum.class, source)); //.orElseThrow(() -> new CloudSDKException(ErrorCodeSourceEnum.class, source));
.orElse(UNKNOWN);
} }
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment