Skip to content

Commit

Permalink
Code update
Browse files Browse the repository at this point in the history
  • Loading branch information
masesdevelopers committed May 23, 2024
1 parent 30791a8 commit 860198d
Showing 1 changed file with 4 additions and 19 deletions.
23 changes: 4 additions & 19 deletions src/net/KEFCore.SerDes/KEFCoreSerDes.Helpers.cs
Original file line number Diff line number Diff line change
Expand Up @@ -197,28 +197,13 @@ public static object FromRecord(Org.Apache.Kafka.Clients.Consumer.ConsumerRecord
public static object FromRawValueData(Type keyType, Type valueContainer, Type keySerializer, Type valueContainerSerializer, string topic, byte[] recordValue, byte[] recordKey, bool throwUnmatch = false)
{
var fullKeySerializer = keySerializer.MakeGenericType(keyType);
Type jvmKeyType = null!;
foreach (var interfaceType in fullKeySerializer.GetInterfaces())
{
if (interfaceType.IsGenericType && interfaceType.Name.StartsWith(typeof(ISerDes<,>).Name))
{
jvmKeyType = interfaceType.GetGenericArguments()[1];
}
}
if (jvmKeyType == null) throw new InvalidOperationException($"Cannot identity JVM type from {keySerializer}");
ISerDes keySerDes = Activator.CreateInstance(fullKeySerializer) as ISerDes;

Check warning on line 200 in src/net/KEFCore.SerDes/KEFCoreSerDes.Helpers.cs

View workflow job for this annotation

GitHub Actions / Analyze (csharp)

Converting null literal or possible null value to non-nullable type.

Check warning on line 200 in src/net/KEFCore.SerDes/KEFCoreSerDes.Helpers.cs

View workflow job for this annotation

GitHub Actions / Analyze (csharp)

Converting null literal or possible null value to non-nullable type.

Check warning on line 200 in src/net/KEFCore.SerDes/KEFCoreSerDes.Helpers.cs

View workflow job for this annotation

GitHub Actions / Analyze (csharp)

Converting null literal or possible null value to non-nullable type.
Type jvmKeyType = (keySerDes?.JVMType) ?? throw new InvalidOperationException($"Cannot identity JVM type from {keySerializer}");

var fullValueContainer = valueContainer.MakeGenericType(keyType);
var fullValueContainerSerializer = valueContainerSerializer.MakeGenericType(fullValueContainer);
Type jvmKValueContainerType = null!;
foreach (var interfaceType in fullValueContainerSerializer.GetInterfaces())
{
if (interfaceType.IsGenericType && interfaceType.Name.StartsWith(typeof(ISerDes<,>).Name))
{
jvmKValueContainerType = interfaceType.GetGenericArguments()[1];
}
}

if (jvmKValueContainerType == null) throw new InvalidOperationException($"Cannot identity JVM type from {fullValueContainerSerializer}");
ISerDes valueContainerSerDes = Activator.CreateInstance(fullValueContainerSerializer) as ISerDes;

Check warning on line 205 in src/net/KEFCore.SerDes/KEFCoreSerDes.Helpers.cs

View workflow job for this annotation

GitHub Actions / Analyze (csharp)

Converting null literal or possible null value to non-nullable type.

Check warning on line 205 in src/net/KEFCore.SerDes/KEFCoreSerDes.Helpers.cs

View workflow job for this annotation

GitHub Actions / Analyze (csharp)

Converting null literal or possible null value to non-nullable type.

Check warning on line 205 in src/net/KEFCore.SerDes/KEFCoreSerDes.Helpers.cs

View workflow job for this annotation

GitHub Actions / Analyze (csharp)

Converting null literal or possible null value to non-nullable type.
Type jvmKValueContainerType = (valueContainerSerDes?.JVMType) ?? throw new InvalidOperationException($"Cannot identity JVM type from {fullValueContainerSerializer}");

var ccType = typeof(LocalEntityExtractor<,,,,,>);
var extractorType = ccType.MakeGenericType(keyType, fullValueContainer, jvmKeyType, jvmKValueContainerType, fullKeySerializer, fullValueContainerSerializer);
Expand Down

0 comments on commit 860198d

Please sign in to comment.