timoninmaxim commented on code in PR #12052:
URL: https://github.com/apache/ignite/pull/12052#discussion_r2073479485


##########
modules/core/src/main/java/org/apache/ignite/internal/binary/BinaryObjectEx.java:
##########
@@ -74,4 +74,34 @@ public default Object[] array() {
     @Nullable public default String enumClassName() {
         throw new UnsupportedOperationException("Not enum");
     }
+
+    /**
+     * @return {@code True} if object has bytes array.
+     */
+    public default boolean hasBytes() {
+        return false;
+    }
+
+    /**
+     * @return Object array if object has byte array based, otherwise {@code 
null}.

Review Comment:
   has -> is



##########
modules/core/src/main/java/org/apache/ignite/internal/binary/GridBinaryMarshaller.java:
##########
@@ -314,7 +314,7 @@ public byte[] marshal(@Nullable Object obj, boolean 
failIfUnregistered) throws B
      * Unwrap binary object.
      */
     private Object unwrapBinary(Object obj, BinaryReaderHandles hnds, Class<?> 
clazz) {
-        if (obj instanceof BinaryObjectImpl) {
+        if (BinaryUtils.isBinaryObjectImpl(obj)) {

Review Comment:
   This looks useless, as we cast to BinaryObjectImpl in next line



##########
modules/core/src/main/java/org/apache/ignite/internal/binary/BinaryUtils.java:
##########
@@ -3028,6 +3055,34 @@ else if (isBinaryArray(a1))
         return Arrays.deepEquals((Object[])a1, (Object[])a2);
     }
 
+    /**
+     * Compare two objects for DML operation.
+     *
+     * @param first First.
+     * @param second Second.
+     * @return Comparison result.
+     */
+    public static int compareForDml(Object first, Object second) {
+        return BinaryObjectImpl.compareForDml(first, second);
+    }
+
+    /**
+     * @param o Object to detach.
+     * @return Detached object.
+     */
+    public static Object detach(Object o) {

Review Comment:
   `CacheObject detach(CacheObject o)`.



##########
modules/core/src/main/java/org/apache/ignite/internal/binary/BinaryObjectEx.java:
##########
@@ -74,4 +74,34 @@ public default Object[] array() {
     @Nullable public default String enumClassName() {
         throw new UnsupportedOperationException("Not enum");
     }
+
+    /**
+     * @return {@code True} if object has bytes array.
+     */
+    public default boolean hasBytes() {
+        return false;
+    }
+
+    /**
+     * @return Object array if object has byte array based, otherwise {@code 
null}.

Review Comment:
   Javadoc declares that it should return `null` if `hasBytes` returns `false`



##########
modules/core/src/main/java/org/apache/ignite/internal/binary/BinaryUtils.java:
##########
@@ -3028,6 +3055,34 @@ else if (isBinaryArray(a1))
         return Arrays.deepEquals((Object[])a1, (Object[])a2);
     }
 
+    /**
+     * Compare two objects for DML operation.
+     *
+     * @param first First.
+     * @param second Second.
+     * @return Comparison result.
+     */
+    public static int compareForDml(Object first, Object second) {
+        return BinaryObjectImpl.compareForDml(first, second);
+    }
+
+    /**
+     * @param o Object to detach.
+     * @return Detached object.
+     */
+    public static Object detach(Object o) {
+        ((BinaryObjectImpl)o).detachAllowed(true);
+        return ((BinaryObjectImpl)o).detach();
+    }
+
+    /**
+     * @param o
+     */
+    public static void detachAllowedIfPossible(Object o) {

Review Comment:
   used in single place, lets inline it



-- 
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: notifications-unsubscr...@ignite.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to