/// <summary> /// Writes an instance. /// </summary> public static void Write(IBinaryRawWriter writer, IBinaryEqualityComparer comparer) { if (comparer == null) { writer.WriteByte((byte)Type.None); return; } var arrCmp = comparer as BinaryArrayEqualityComparer; if (arrCmp != null) { writer.WriteByte((byte)Type.Array); return; } var fieldCmp = (BinaryFieldEqualityComparer)comparer; writer.WriteByte((byte)Type.Field); fieldCmp.Validate(); writer.WriteInt(fieldCmp.FieldNames.Count); foreach (var field in fieldCmp.FieldNames) { writer.WriteString(field); } }
/// <summary> /// Constructor. /// </summary> /// <param name="type">Type.</param> /// <param name="typeId">Type ID.</param> /// <param name="typeName">Type name.</param> /// <param name="userType">User type flag.</param> /// <param name="nameMapper">Name converter.</param> /// <param name="idMapper">Mapper.</param> /// <param name="serializer">Serializer.</param> /// <param name="keepDeserialized">Whether to cache deserialized value in IBinaryObject</param> /// <param name="affKeyFieldName">Affinity field key name.</param> /// <param name="isEnum">Enum flag.</param> /// <param name="comparer">Equality comparer.</param> public BinaryFullTypeDescriptor( Type type, int typeId, string typeName, bool userType, IBinaryNameMapper nameMapper, IBinaryIdMapper idMapper, IBinarySerializerInternal serializer, bool keepDeserialized, string affKeyFieldName, bool isEnum, IEqualityComparer <IBinaryObject> comparer) { _type = type; _typeId = typeId; _typeName = typeName; _userType = userType; _nameMapper = nameMapper; _idMapper = idMapper; _serializer = serializer; _keepDeserialized = keepDeserialized; _affKeyFieldName = affKeyFieldName; _isEnum = isEnum; _equalityComparer = comparer as IBinaryEqualityComparer; if (comparer != null && _equalityComparer == null) { throw new IgniteException(string.Format("Unsupported IEqualityComparer<IBinaryObject> " + "implementation: {0}. Only predefined implementations " + "are supported.", comparer.GetType())); } }
/// <summary> /// Initializes a new instance of the <see cref="BinaryFullTypeDescriptor"/> class, /// copying values from specified descriptor. /// </summary> /// <param name="desc">The descriptor to copy from.</param> /// <param name="type">Type.</param> /// <param name="serializer">Serializer.</param> /// <param name="isRegistered">Registered flag.</param> public BinaryFullTypeDescriptor(BinaryFullTypeDescriptor desc, Type type, IBinarySerializerInternal serializer, bool isRegistered) { _type = type; _typeId = desc._typeId; _typeName = desc._typeName; _userType = desc._userType; _nameMapper = desc._nameMapper; _idMapper = desc._idMapper; _serializer = serializer; _keepDeserialized = desc._keepDeserialized; _affKeyFieldName = desc._affKeyFieldName; _isEnum = desc._isEnum; _equalityComparer = desc._equalityComparer; _isRegistered = isRegistered; _schema = desc._schema; _writerTypeStruct = desc._writerTypeStruct; _readerTypeStructure = desc._readerTypeStructure; }