zstan commented on code in PR #12629:
URL: https://github.com/apache/ignite/pull/12629#discussion_r2688963945
##########
modules/binary/api/src/main/java/org/apache/ignite/internal/binary/BinaryUtils.java:
##########
@@ -1676,28 +1673,9 @@ static Class resolveClass(BinaryContext ctx, int typeId,
@Nullable String clsNam
* @param type Plain type.
* @return Enum.
Review Comment:
change return type plz.
##########
modules/binary/impl/src/main/java/org/apache/ignite/internal/binary/BinariesFactoryImpl.java:
##########
@@ -142,4 +146,51 @@ public class BinariesFactoryImpl implements
BinariesFactory {
return new BinaryFieldDescriptor(field, id, mode, -1L,
!CommonUtils.isFinal(field.getType()));
}
}
+
+ /** {@inheritDoc} */
+ @Override public BinaryObjectEx binaryEnum(BinaryContext ctx, int typeId,
@Nullable String clsName, int ord) {
+ return new BinaryEnumObjectImpl(ctx, typeId, clsName, ord);
+ }
+
+ /** {@inheritDoc} */
+ @Override public BinaryObjectEx binaryEnum(BinaryContext ctx, byte[] arr) {
+ return new BinaryEnumObjectImpl(ctx, arr);
+ }
+
+ /** {@inheritDoc} */
+ @Override public Class<?> binaryEnumClass() {
+ return BinaryEnumObjectImpl.class;
+ }
+
+ /** {@inheritDoc} */
+ @Override public Map<Class<?>, Integer> predefinedTypes() {
+ Map<Class<?>, Integer> predefinedTypes = new HashMap<>();
+
+ predefinedTypes.put(BinaryEnumObjectImpl.class, 0);
+
+ return predefinedTypes;
Review Comment:
```suggestion
return Map.of(BinaryEnumObjectImpl.class, 0);
```
##########
modules/binary/api/src/main/java/org/apache/ignite/internal/binary/BinariesFactory.java:
##########
@@ -99,4 +101,37 @@ public BinaryReaderEx reader(BinaryContext ctx,
* @return Accessor.
*/
public BinaryFieldDescriptor create(Field field, int id);
+
+ /**
+ * Creates binary enum.
+ *
+ * @param typeId Type ID.
+ * @param clsName Class name.
+ * @param ord Ordinal.
+ * @param ctx Context.
+ */
+ public BinaryObjectEx binaryEnum(BinaryContext ctx, int typeId, @Nullable
String clsName, int ord);
Review Comment:
can you also notate with @Nullable clsName in BinaryEnumObjectImpl ? but
it`s up to you
##########
modules/binary/api/src/main/java/org/apache/ignite/internal/binary/BinaryContext.java:
##########
@@ -260,11 +260,12 @@ public BinaryContext(
registerPredefinedType(BinaryObjectImpl.class, 0);
registerPredefinedType(BinaryObjectOffheapImpl.class, 0);
registerPredefinedType(BinaryMetadata.class, 0);
- registerPredefinedType(BinaryEnumObjectImpl.class, 0);
Review Comment:
can you also remove GG mention from line 213 ?
--
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]