11package dev .team .hytalib .utils ;
22
33
4- import org .jetbrains .annotations .Nullable ;
54
65import java .text .DecimalFormat ;
76
109 */
1110public class NumberUtils {
1211
13- public static boolean isDouble (@ Nullable String value ) {
12+ public static boolean isDouble (String value ) {
1413 if (value == null ) return false ;
1514 try {
1615 Double .parseDouble (value );
@@ -20,7 +19,7 @@ public static boolean isDouble(@Nullable String value) {
2019 }
2120 }
2221
23- public static boolean isInt (@ Nullable String value ) {
22+ public static boolean isInt (String value ) {
2423 if (value == null ) return false ;
2524 try {
2625 Integer .parseInt (value );
@@ -30,7 +29,7 @@ public static boolean isInt(@Nullable String value) {
3029 }
3130 }
3231
33- public static boolean isLong (@ Nullable String value ) {
32+ public static boolean isLong (String value ) {
3433 if (value == null ) return false ;
3534 try {
3635 Long .parseLong (value );
@@ -40,7 +39,7 @@ public static boolean isLong(@Nullable String value) {
4039 }
4140 }
4241
43- public static boolean isFloat (@ Nullable String value ) {
42+ public static boolean isFloat (String value ) {
4443 if (value == null ) return false ;
4544 try {
4645 Float .parseFloat (value );
@@ -50,19 +49,19 @@ public static boolean isFloat(@Nullable String value) {
5049 }
5150 }
5251
53- public static int getIntOrDefault (@ Nullable String value , int def ) {
52+ public static int getIntOrDefault (String value , int def ) {
5453 return isInt (value ) ? Integer .parseInt (value ) : def ;
5554 }
5655
57- public static double getDoubleOrDefault (@ Nullable String value , double def ) {
56+ public static double getDoubleOrDefault (String value , double def ) {
5857 return isDouble (value ) ? Double .parseDouble (value ) : def ;
5958 }
6059
61- public static long getLongOrDefault (@ Nullable String value , long def ) {
60+ public static long getLongOrDefault (String value , long def ) {
6261 return isLong (value ) ? Long .parseLong (value ) : def ;
6362 }
6463
65- public static float getFloatOrDefault (@ Nullable String value , float def ) {
64+ public static float getFloatOrDefault (String value , float def ) {
6665 return isFloat (value ) ? Float .parseFloat (value ) : def ;
6766 }
6867
0 commit comments