AMashenkov commented on a change in pull request #284: URL: https://github.com/apache/ignite-3/pull/284#discussion_r700009087
########## File path: modules/client-common/src/main/java/org/apache/ignite/client/proto/ClientMessagePacker.java ########## @@ -550,6 +573,75 @@ public ClientMessagePacker packObject(Object val) { throw new UnsupportedOperationException("Unsupported type, can't serialize: " + val.getClass()); } + /** + * Packs an array of different objects. + * + * @param args Object array. + * @return This instance. + * @throws UnsupportedOperationException in case of unknown type. + */ + public ClientMessagePacker packObjectArray(Object[] args) { + assert !closed : "Packer is closed"; + + if (args == null) { + packNil(); + + return this; + } + + packArrayHeader(args.length); + + for (Object arg : args) { + if (arg == null) { + packNil(); + + continue; + } + + Class<?> cls = arg.getClass(); + + if (cls == Boolean.class) + packBoolean((Boolean)arg); + else if (cls == Byte.class) { + packInt(ClientDataType.INT8); + packByte((Byte)arg); + } + else if (cls == Short.class) { + packInt(ClientDataType.INT16); + packShort((Short)arg); + } + else if (cls == Integer.class) { + packInt(ClientDataType.INT32); + packInt((Integer)arg); + } + else if (cls == Long.class) { + packInt(ClientDataType.INT64); + packLong((Long)arg); + } + else if (cls == Float.class) + packFloat((Float)arg); + else if (cls == Double.class) + packDouble((Double)arg); + else if (cls == String.class) + packString((String)arg); + else if (cls == UUID.class) { + packInt(ClientDataType.UUID); + packUuid((UUID)arg); + } + else if (cls == byte[].class) + writeByteArray((byte[])arg); + else + throw new UnsupportedOperationException("Custom objects are not supported"); Review comment: Can this be replaced with packObject() ? -- 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