forked from plusone/plusone-commons
添加 equalsCode 方法
parent
7f80a411db
commit
9a0b6404cb
|
@ -16,6 +16,8 @@
|
|||
|
||||
package xyz.zhouxy.plusone.commons.base;
|
||||
|
||||
import java.util.Objects;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
/**
|
||||
|
@ -28,4 +30,8 @@ import javax.annotation.Nonnull;
|
|||
public interface IWithCode<T> {
|
||||
@Nonnull
|
||||
T getCode();
|
||||
|
||||
default boolean equalsCode(T code) {
|
||||
return Objects.equals(getCode(), code);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -25,4 +25,8 @@ package xyz.zhouxy.plusone.commons.base;
|
|||
*/
|
||||
public interface IWithIntCode {
|
||||
int getCode();
|
||||
|
||||
default boolean equalsCode(int code) {
|
||||
return getCode() == code;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -25,4 +25,8 @@ package xyz.zhouxy.plusone.commons.base;
|
|||
*/
|
||||
public interface IWithLongCode {
|
||||
long getCode();
|
||||
|
||||
default boolean equalsCode(long code) {
|
||||
return getCode() == code;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue