diff --git a/pom.xml b/pom.xml
index b273a54..ac1e49b 100644
--- a/pom.xml
+++ b/pom.xml
@@ -4,7 +4,7 @@
4.0.0
pw.yumc
YumCore
- 1.8.5
+ 1.8.6
${project.artifactId}
diff --git a/src/main/java/pw/yumc/YumCore/utils/Assert.java b/src/main/java/pw/yumc/YumCore/utils/Assert.java
new file mode 100644
index 0000000..fe0be7c
--- /dev/null
+++ b/src/main/java/pw/yumc/YumCore/utils/Assert.java
@@ -0,0 +1,46 @@
+package pw.yumc.YumCore.utils;
+
+import java.util.Objects;
+import java.util.function.Consumer;
+
+/**
+ * Created with IntelliJ IDEA
+ *
+ * @author 喵♂呜
+ * Created on 2017/9/1 10:49.
+ */
+public class Assert {
+ private T t;
+
+ public static Assert of(T value) {
+ return new Assert<>(value);
+ }
+
+ public static void runIsTrue(Boolean bool, Runnable runnable) {
+ if (bool)
+ runnable.run();
+ }
+
+ public static void runOrElse(Boolean bool, Runnable t, Runnable f) {
+ if (bool)
+ t.run();
+ else
+ f.run();
+ }
+
+ public Assert(T t) {
+ this.t = t;
+ }
+
+ public void runNonNull(Consumer super T> consumer) {
+ runIsTrue(Objects.nonNull(t), () -> consumer.accept(t));
+ }
+
+ public void runIsNull(Consumer super T> consumer) {
+ runIsTrue(Objects.isNull(t), () -> consumer.accept(t));
+ }
+
+ public void runIsAssignable(Class clazz, Consumer super T> consumer) {
+ runIsTrue(clazz.isAssignableFrom(t.getClass()), () -> consumer.accept(t));
+ }
+}
\ No newline at end of file