diff --git a/src/main/java/xyz/zhouxy/plusone/commons/util/OrdinaryResult.java b/src/main/java/xyz/zhouxy/plusone/commons/util/CustomResult.java similarity index 55% rename from src/main/java/xyz/zhouxy/plusone/commons/util/OrdinaryResult.java rename to src/main/java/xyz/zhouxy/plusone/commons/util/CustomResult.java index 0659cc0..ee8bf19 100644 --- a/src/main/java/xyz/zhouxy/plusone/commons/util/OrdinaryResult.java +++ b/src/main/java/xyz/zhouxy/plusone/commons/util/CustomResult.java @@ -1,17 +1,17 @@ package xyz.zhouxy.plusone.commons.util; /** - * 普通结果 + * 自定义结果 * * @author zhouxy */ -final class OrdinaryResult extends UnifiedResponse { +final class CustomResult extends UnifiedResponse { - OrdinaryResult(Object status, String message) { + CustomResult(Object status, String message) { super(status, message); } - OrdinaryResult(Object status, String message, Object data) { + CustomResult(Object status, String message, Object data) { super(status, message, data); } diff --git a/src/main/java/xyz/zhouxy/plusone/commons/util/UnifiedResponse.java b/src/main/java/xyz/zhouxy/plusone/commons/util/UnifiedResponse.java index 8512079..bf94227 100644 --- a/src/main/java/xyz/zhouxy/plusone/commons/util/UnifiedResponse.java +++ b/src/main/java/xyz/zhouxy/plusone/commons/util/UnifiedResponse.java @@ -16,6 +16,7 @@ package xyz.zhouxy.plusone.commons.util; +import xyz.zhouxy.plusone.commons.annotation.UnsupportedOperation; import xyz.zhouxy.plusone.commons.base.IWithCode; import java.util.HashMap; @@ -77,22 +78,22 @@ public abstract class UnifiedResponse extends HashMap { } public static UnifiedResponse of(Object status, String message) { - return new OrdinaryResult(status, message); + return new CustomResult(status, message); } public static UnifiedResponse of(Object status, String message, Object data) { - return new OrdinaryResult(status, message, data); + return new CustomResult(status, message, data); } public static UnifiedResponse of(final boolean isSuccess, - final Supplier success, final Supplier error) { + final Supplier success, final Supplier error) { Preconditions.checkNotNull(success, "Success supplier must not be null."); Preconditions.checkNotNull(error, "Error supplier must not be null."); return isSuccess ? success.get() : error.get(); } public static UnifiedResponse of(final BooleanSupplier isSuccess, - final Supplier success, final Supplier error) { + final Supplier success, final Supplier error) { Preconditions.checkNotNull(isSuccess, "Conditions for success must not be null."); Preconditions.checkNotNull(success, "Success supplier must not be null."); Preconditions.checkNotNull(error, "Error supplier must not be null."); @@ -130,6 +131,7 @@ public abstract class UnifiedResponse extends HashMap { /** * @deprecated Unsupported operation. */ + @UnsupportedOperation @Deprecated @Override public Object put(String key, Object value) { @@ -139,6 +141,7 @@ public abstract class UnifiedResponse extends HashMap { /** * @deprecated Unsupported operation. */ + @UnsupportedOperation @Deprecated @Override public void putAll(Map m) { @@ -148,6 +151,7 @@ public abstract class UnifiedResponse extends HashMap { /** * @deprecated Unsupported operation. */ + @UnsupportedOperation @Deprecated @Override public Object remove(Object key) { @@ -157,6 +161,7 @@ public abstract class UnifiedResponse extends HashMap { /** * @deprecated Unsupported operation. */ + @UnsupportedOperation @Deprecated @Override public void clear() { @@ -166,6 +171,7 @@ public abstract class UnifiedResponse extends HashMap { /** * @deprecated Unsupported operation. */ + @UnsupportedOperation @Deprecated @Override public Object putIfAbsent(String key, Object value) { @@ -175,6 +181,7 @@ public abstract class UnifiedResponse extends HashMap { /** * @deprecated Unsupported operation. */ + @UnsupportedOperation @Deprecated @Override public boolean remove(Object key, Object value) { @@ -184,6 +191,7 @@ public abstract class UnifiedResponse extends HashMap { /** * @deprecated Unsupported operation. */ + @UnsupportedOperation @Deprecated @Override public boolean replace(String key, Object oldValue, Object newValue) { @@ -193,6 +201,7 @@ public abstract class UnifiedResponse extends HashMap { /** * @deprecated Unsupported operation. */ + @UnsupportedOperation @Deprecated @Override public Object replace(String key, Object value) { @@ -202,6 +211,7 @@ public abstract class UnifiedResponse extends HashMap { /** * @deprecated Unsupported operation. */ + @UnsupportedOperation @Deprecated @Override public Object computeIfAbsent(String key, Function mappingFunction) { @@ -211,6 +221,7 @@ public abstract class UnifiedResponse extends HashMap { /** * @deprecated Unsupported operation. */ + @UnsupportedOperation @Deprecated @Override public Object computeIfPresent(String key, BiFunction remappingFunction) { @@ -220,6 +231,7 @@ public abstract class UnifiedResponse extends HashMap { /** * @deprecated Unsupported operation. */ + @UnsupportedOperation @Deprecated @Override public Object compute(String key, BiFunction remappingFunction) { @@ -229,6 +241,7 @@ public abstract class UnifiedResponse extends HashMap { /** * @deprecated Unsupported operation. */ + @UnsupportedOperation @Deprecated @Override public Object merge(String key, Object value, BiFunction remappingFunction) { @@ -238,6 +251,7 @@ public abstract class UnifiedResponse extends HashMap { /** * @deprecated Unsupported operation. */ + @UnsupportedOperation @Deprecated @Override public void replaceAll(BiFunction function) {