add helper methods to ReturnCode
This commit is contained in:
parent
06a736fda4
commit
bdb9601069
@ -31,6 +31,14 @@ public class ReturnCode {
|
|||||||
this.value = value;
|
this.value = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static boolean isSuccess(final ReturnCode returnCode) {
|
||||||
|
return (returnCode != null && returnCode.getValue() == SUCCESS);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static boolean isCancel(final ReturnCode returnCode) {
|
||||||
|
return (returnCode != null && returnCode.getValue() == CANCEL);
|
||||||
|
}
|
||||||
|
|
||||||
public int getValue() {
|
public int getValue() {
|
||||||
return value;
|
return value;
|
||||||
}
|
}
|
||||||
|
@ -31,6 +31,10 @@ typedef NS_ENUM(NSUInteger, ReturnCodeEnum) {
|
|||||||
|
|
||||||
- (instancetype)init:(int)value;
|
- (instancetype)init:(int)value;
|
||||||
|
|
||||||
|
+ (BOOL)isSuccess:(ReturnCode*)value;
|
||||||
|
|
||||||
|
+ (BOOL)isCancel:(ReturnCode*)value;
|
||||||
|
|
||||||
- (int)getValue;
|
- (int)getValue;
|
||||||
|
|
||||||
- (BOOL)isSuccess;
|
- (BOOL)isSuccess;
|
||||||
|
@ -32,6 +32,14 @@
|
|||||||
return self;
|
return self;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
+ (BOOL)isSuccess:(ReturnCode*)value {
|
||||||
|
return (value != nil) && ([value getValue] == ReturnCodeSuccess);
|
||||||
|
}
|
||||||
|
|
||||||
|
+ (BOOL)isCancel:(ReturnCode*)value {
|
||||||
|
return (value != nil) && ([value getValue] == ReturnCodeCancel);
|
||||||
|
}
|
||||||
|
|
||||||
- (int)getValue {
|
- (int)getValue {
|
||||||
return _value;
|
return _value;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user