Skip to content

Commit cc796a1

Browse files
javaqueryVicky Thakor
authored andcommitted
fix: make class final and constructor private
1 parent 331f280 commit cc796a1

File tree

6 files changed

+18
-9
lines changed

6 files changed

+18
-9
lines changed

src/main/java/com/javaquery/util/Assert.java

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,7 @@
1414
*/
1515
public final class Assert {
1616

17-
private Assert() {
18-
}
17+
private Assert() {}
1918

2019
/**
2120
* <em>Assert</em> that {@code object} is {@code not null}.
@@ -27,7 +26,7 @@ private Assert() {
2726
* @throws NullPointerException if {@code object} is {@code null} and {@code exceptionSupplier} is {@code null}
2827
*/
2928
public static <T extends Throwable> void nonNull(Object object, Supplier<T> exceptionSupplier) throws T {
30-
if (object == null) {
29+
if (Objects.isNull(object)) {
3130
throw exceptionSupplier.get();
3231
}
3332
}
@@ -42,7 +41,7 @@ public static <T extends Throwable> void nonNull(Object object, Supplier<T> exce
4241
* @throws NullPointerException if {@code object} is {@code not null} and {@code exceptionSupplier} is {@code null}
4342
*/
4443
public static <T extends Throwable> void isNull(Object object, Supplier<T> exceptionSupplier) throws T {
45-
if (object != null) {
44+
if (Objects.nonNull(object)) {
4645
throw exceptionSupplier.get();
4746
}
4847
}

src/main/java/com/javaquery/util/Objects.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,9 @@
44
* @author vicky.thakor
55
* @since 1.0
66
*/
7-
public class Objects {
7+
public final class Objects {
8+
9+
private Objects(){}
810

911
/**
1012
* Returns {@code true} if the provided reference is {@code null} otherwise

src/main/java/com/javaquery/util/Regex.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,9 @@
66
* @author vicky.thakor
77
* @since 1.0
88
*/
9-
public class Regex {
9+
public final class Regex {
10+
11+
private Regex(){}
1012

1113
public static final String REGEX_NUMBER = "^-?[0-9]\\d*(\\.\\d+)?$";
1214
public static final String REGEX_ALPHA_NUMERIC = "^[a-zA-Z0-9]*$";

src/main/java/com/javaquery/util/collection/Collections.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,9 @@
1212
* @author vicky.thakor
1313
* @since 1.0
1414
*/
15-
public class Collections {
15+
public final class Collections {
16+
17+
private Collections(){}
1618

1719
/**
1820
* Returns {@code true} if the provided Collection [List, Set] is {@code null} or empty otherwise

src/main/java/com/javaquery/util/string/Strings.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,9 @@
1010
* @author vicky.thakor
1111
* @since 1.0
1212
*/
13-
public class Strings {
13+
public final class Strings {
14+
15+
private Strings(){}
1416

1517
private final static String UNSUPPORTED_ASCII_PATTERN = "[^\\x20-\\x7e]";
1618
private final static String UNSUPPORTED_UNICODE_PATTERN = "[\\uD83C-\\uDBFF\\uDC00-\\uDFFF]+";

src/main/java/com/javaquery/util/time/Dates.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,9 @@
1212
* @author vicky.thakor
1313
* @since 1.0
1414
*/
15-
public class Dates {
15+
public final class Dates {
16+
17+
private Dates(){}
1618

1719
public static final TimeZone SYSTEM_TIMEZONE = TimeZone.getDefault();
1820
private static final Calendar CALENDAR = Calendar.getInstance();

0 commit comments

Comments
 (0)