rpuch commented on code in PR #3565:
URL: https://github.com/apache/ignite-3/pull/3565#discussion_r1557435036
##########
modules/core/src/main/java/org/apache/ignite/internal/wrapper/Wrappers.java:
##########
@@ -34,4 +36,19 @@ public static <T> T unwrap(Object object, Class<T>
classToUnwrap) {
return classToUnwrap.cast(object);
}
+
+ /**
+ * Unwraps an object or returns {@code null} if it's {@code null}.
+ *
+ * @param object Object to unwrap.
+ * @param classToUnwrap Class which is to be unwrapped.
+ * @see #unwrap(Object, Class)
+ */
+ public static @Nullable <T> T unwrapNullable(@Nullable Object object,
Class<T> classToUnwrap) {
Review Comment:
The reason I added another method is nullability. If we have just one
method, it must allow a nullable argument and the return value must be
nullable. But there are many cases where we are sure that the argument (that we
want to unwrap) is not nullable, and we want the result to be non-nullable too.
It seems that we cannot achieve this with just one method, hence having 2 seems
to be handy.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]