-
-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: divorce
UncheckedCasts
API for Class
- Loading branch information
1 parent
809c7d6
commit 4924d11
Showing
9 changed files
with
49 additions
and
40 deletions.
There are no files selected for viewing
10 changes: 10 additions & 0 deletions
10
java-commons/src/main/java/ru/progrm_jarvis/javacommons/JavaCommons.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
package ru.progrm_jarvis.javacommons; | ||
|
||
import lombok.experimental.UtilityClass; | ||
|
||
/** | ||
* Utilities mostly used by <b>java-commons</b> internals. | ||
*/ | ||
@UtilityClass | ||
public class JavaCommons { | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
29 changes: 29 additions & 0 deletions
29
java-commons/src/main/java/ru/progrm_jarvis/javacommons/unchecked/UncheckedCasts.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
package ru.progrm_jarvis.javacommons.unchecked; | ||
|
||
import lombok.experimental.UtilityClass; | ||
import org.jetbrains.annotations.Contract; | ||
|
||
/** | ||
* Commonly used unchecked cast operations. | ||
* | ||
* @apiNote no nullability annotations are present on parameters and return types | ||
* because casts of {@code null} are always safe | ||
*/ | ||
@UtilityClass | ||
public class UncheckedCasts { | ||
|
||
/** | ||
* Casts the given class object into the specific one. | ||
* | ||
* @param type raw-typed class object | ||
* @param <T> exact wanted type of class object | ||
* @return the provided class object with its type cast to the specific one | ||
* | ||
* @apiNote this is effectively no-op | ||
*/ | ||
@Contract("_ -> param1") | ||
@SuppressWarnings("unchecked") | ||
public <T> Class<T> uncheckedClassCast(final Class<?> type) { | ||
return (Class<T>) type; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters