sashapolo commented on a change in pull request #605:
URL: https://github.com/apache/ignite-3/pull/605#discussion_r794576561



##########
File path: 
modules/configuration/src/main/java/org/apache/ignite/internal/configuration/util/ConfigurationSerializationUtil.java
##########
@@ -0,0 +1,409 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ignite.internal.configuration.util;
+
+import java.io.Serializable;
+import java.nio.ByteBuffer;
+import java.nio.ByteOrder;
+import java.nio.charset.StandardCharsets;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+import java.util.Objects;
+
+/**
+ * Utility class to help serializing  deserializing configuration values - 
primitives, strings, or arrays of primitives or strings.
+ */
+public class ConfigurationSerializationUtil {
+    private static final byte BOOLEAN = 1;
+
+    private static final byte BYTE = 2;
+
+    private static final byte SHORT = 3;
+
+    private static final byte INT = 4;
+
+    private static final byte LONG = 5;
+
+    private static final byte CHAR = 6;
+
+    private static final byte FLOAT = 7;
+
+    private static final byte DOUBLE = 8;
+
+    private static final byte STRING = 9;
+
+    private static final byte ARRAY = (byte) 0x80;
+    private static final String[] EMPTY_STRING_ARRAY = new String[0];
+
+    /**
+     * Converts configuration value into a byte array.
+     *
+     * @param value Configuration values.
+     * @return Serialized value.
+     */
+    public static byte[] toBytes(Serializable value) {

Review comment:
       I think you should write some tests for this functionality




-- 
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]


Reply via email to