nizhikov commented on a change in pull request #9490:
URL: https://github.com/apache/ignite/pull/9490#discussion_r754430902
##########
File path:
modules/core/src/main/java/org/apache/ignite/internal/binary/BinaryUtils.java
##########
@@ -2554,6 +2591,41 @@ public static void validateEnumValues(String typeName,
@Nullable Map<String, Int
return mergedMap;
}
+ /**
+ * @param obj {@link BinaryArray} or {@code Object[]}.
+ * @return Objects array.
+ */
+ public static Object[] rawArrayFromBinary(Object obj) {
+ if (obj instanceof BinaryArray)
+ // We want raw data(no deserialization).
+ return ((BinaryArray)obj).array();
+ else
+ // This can happen even in BinaryArray.USE_TYPED_ARRAY = true.
+ // In case user pass special array type to arguments, String[],
for example.
+ return (Object[])obj;
+ }
+
+ /** */
+ public static Object[] rawArrayInArgs(Object[] args, boolean keepBinary) {
+ if (args == null)
+ return args;
+
+ for (int i = 0; i < args.length; i++) {
+ if (args[i] instanceof BinaryArray) {
+ BinaryArray arr = (BinaryArray)args[i];
+
+ args[i] = keepBinary ? arr.array() : arr.deserialize();
+ }
+ }
+
+ return args;
+ }
+
+ /** */
+ public static boolean isObjectArray(Class<?> cls) {
+ return Object[].class == cls || BinaryArray.class == cls;
Review comment:
It seems there no more `isAssignableFrom`, `isInstance` calls, so I
think we can keep this method as is.
What do you think?
--
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]