zstan commented on code in PR #12626:
URL: https://github.com/apache/ignite/pull/12626#discussion_r2682537917
##########
modules/binary/api/src/main/java/org/apache/ignite/internal/binary/BinaryClassDescriptor.java:
##########
@@ -365,12 +365,12 @@ else if (useOptMarshaller)
if (!ids.add(fieldId))
throw new BinaryObjectException("Duplicate
field ID: " + name);
- BinaryFieldAccessor fieldInfo =
BinaryFieldAccessor.create(f, fieldId);
+ BinaryFieldAccessor fieldInfo =
BinaryUtils.binariesFactory.create(f, fieldId);
fields0.put(name, fieldInfo);
if (metaDataEnabled)
- stableFieldsMeta.put(name, new
BinaryFieldMetadata(fieldInfo));
+ stableFieldsMeta.put(name, new
BinaryFieldMetadata(fieldInfo.mode.typeId(), fieldInfo.id));
Review Comment:
```suggestion
stableFieldsMeta.put(name, new
BinaryFieldMetadata(fieldInfo.mode().typeId(), fieldInfo.id));
```
##########
modules/binary/api/src/main/java/org/apache/ignite/internal/binary/BinariesFactory.java:
##########
@@ -0,0 +1,101 @@
+/*
+ * 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.binary;
+
+import java.lang.reflect.Field;
+import org.apache.ignite.internal.binary.streams.BinaryInputStream;
+import org.apache.ignite.internal.binary.streams.BinaryOutputStream;
+import org.jetbrains.annotations.Nullable;
+
+/**
+ * Factory for binaries classes creation.
+ */
+public interface BinariesFactory {
+ /**
+ * Creates reader instance.
+ *
+ * @param ctx Context.
+ * @param in Input stream.
+ * @param ldr Class loader.
+ * @param forUnmarshal {@code True} if reader is needed to unmarshal
object.
+ */
+ public BinaryReaderEx reader(BinaryContext ctx, BinaryInputStream in,
ClassLoader ldr, boolean forUnmarshal);
+
+ /**
+ * Creates reader instance.
+ *
+ * @param ctx Context.
+ * @param in Input stream.
+ * @param ldr Class loader.
+ * @param hnds Context.
+ * @param forUnmarshal {@code True} if reader is need to unmarshal object.
+ */
+ public BinaryReaderEx reader(BinaryContext ctx,
+ BinaryInputStream in,
+ ClassLoader ldr,
+ @Nullable BinaryReaderHandles hnds,
+ boolean forUnmarshal);
+
+ /**
+ * Constructor.
+ *
+ * @param ctx Context.
+ * @param in Input stream.
+ * @param ldr Class loader.
+ * @param hnds Context.
+ * @param skipHdrCheck Whether to skip header check.
+ * @param forUnmarshal {@code True} if reader is need to unmarshal object.
+ */
+ public BinaryReaderEx reader(BinaryContext ctx,
+ BinaryInputStream in,
+ ClassLoader ldr,
+ @Nullable BinaryReaderHandles hnds,
+ boolean skipHdrCheck,
+ boolean forUnmarshal);
+
+ /**
+ * @param ctx Context.
+ * @param failIfUnregistered Flag to fail while writing object of
unregistered type.
+ * @param typeId Type id.
+ * @return Writer instance.
+ */
+ public BinaryWriterEx writer(BinaryContext ctx, boolean
failIfUnregistered, int typeId);
+
+ /**
+ * @param ctx Context.
+ * @param out Output stream.
+ * @return Writer instance.
+ */
+ public BinaryWriterEx writer(BinaryContext ctx, BinaryOutputStream out);
+
+ /**
+ * @param ctx Context.
+ * @param out Output stream.
+ * @return Writer instance.
+ */
+ public BinaryWriterEx writer(BinaryContext ctx, BinaryOutputStream out,
BinaryWriterSchemaHolder schema);
Review Comment:
missed "schema" param
--
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]