Commit 71ebfcd2 by gdj

调整枚举。

parent c35817d3
...@@ -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);
} }
} }
...@@ -14,6 +14,10 @@ import java.util.Arrays; ...@@ -14,6 +14,10 @@ import java.util.Arrays;
*/ */
public enum ErrorCodeSourceEnum { public enum ErrorCodeSourceEnum {
UNKNOWN(-1),
ZERO(0),
DEVICE(3), DEVICE(3),
DOCK(5), DOCK(5),
...@@ -34,6 +38,7 @@ public enum ErrorCodeSourceEnum { ...@@ -34,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