Skip to content

Commit 6fa9d89

Browse files
chore(internal): use nicer generic names
1 parent 049b82c commit 6fa9d89

File tree

3 files changed

+23
-23
lines changed

3 files changed

+23
-23
lines changed

src/Orb/IEnum.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
namespace Orb;
22

3-
public interface IEnum<IE, T>
4-
where IE : IEnum<IE, T>
3+
public interface IEnum<TEnum, TValue>
4+
where TEnum : IEnum<TEnum, TValue>
55
{
6-
static abstract IE FromRaw(T value);
7-
T Raw();
6+
static abstract TEnum FromRaw(TValue value);
7+
TValue Raw();
88
}

src/Orb/IVariant.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
namespace Orb;
22

3-
public interface IVariant<IV, T>
4-
where IV : IVariant<IV, T>
3+
public interface IVariant<TVariant, TValue>
4+
where TVariant : IVariant<TVariant, TValue>
55
{
6-
static abstract IV From(T value);
7-
T Value { get; }
6+
static abstract TVariant From(TValue value);
7+
TValue Value { get; }
88
}

src/Orb/JsonConverters.cs

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,10 @@
77

88
namespace Orb;
99

10-
public sealed class ModelConverter<MB> : JsonConverter<MB>
11-
where MB : ModelBase, IFromRaw<MB>
10+
public sealed class ModelConverter<TModel> : JsonConverter<TModel>
11+
where TModel : ModelBase, IFromRaw<TModel>
1212
{
13-
public override MB? Read(
13+
public override TModel? Read(
1414
ref Utf8JsonReader reader,
1515
System::Type _typeToConvert,
1616
JsonSerializerOptions options
@@ -22,28 +22,28 @@ JsonSerializerOptions options
2222
if (properties == null)
2323
return null;
2424

25-
return MB.FromRawUnchecked(properties);
25+
return TModel.FromRawUnchecked(properties);
2626
}
2727

28-
public override void Write(Utf8JsonWriter writer, MB value, JsonSerializerOptions options)
28+
public override void Write(Utf8JsonWriter writer, TModel value, JsonSerializerOptions options)
2929
{
3030
JsonSerializer.Serialize(writer, value.Properties, options);
3131
}
3232
}
3333

34-
public sealed class EnumConverter<IE, T> : JsonConverter<IE>
35-
where IE : IEnum<IE, T>
34+
public sealed class EnumConverter<TEnum, TValue> : JsonConverter<TEnum>
35+
where TEnum : IEnum<TEnum, TValue>
3636
{
37-
public override IE Read(
37+
public override TEnum Read(
3838
ref Utf8JsonReader reader,
3939
System::Type _typeToConvert,
4040
JsonSerializerOptions options
4141
)
4242
{
43-
return IE.FromRaw(JsonSerializer.Deserialize<T>(ref reader, options)!);
43+
return TEnum.FromRaw(JsonSerializer.Deserialize<TValue>(ref reader, options)!);
4444
}
4545

46-
public override void Write(Utf8JsonWriter writer, IE value, JsonSerializerOptions options)
46+
public override void Write(Utf8JsonWriter writer, TEnum value, JsonSerializerOptions options)
4747
{
4848
JsonSerializer.Serialize(writer, value.Raw(), options);
4949
}
@@ -89,19 +89,19 @@ public override void Write(Utf8JsonWriter writer, T value, JsonSerializerOptions
8989
}
9090
}
9191

92-
public sealed class VariantConverter<IV, T> : JsonConverter<IV>
93-
where IV : IVariant<IV, T>
92+
public sealed class VariantConverter<TVariant, TValue> : JsonConverter<TVariant>
93+
where TVariant : IVariant<TVariant, TValue>
9494
{
95-
public override IV Read(
95+
public override TVariant Read(
9696
ref Utf8JsonReader reader,
9797
System::Type _typeToConvert,
9898
JsonSerializerOptions options
9999
)
100100
{
101-
return IV.From(JsonSerializer.Deserialize<T>(ref reader, options)!);
101+
return TVariant.From(JsonSerializer.Deserialize<TValue>(ref reader, options)!);
102102
}
103103

104-
public override void Write(Utf8JsonWriter writer, IV value, JsonSerializerOptions options)
104+
public override void Write(Utf8JsonWriter writer, TVariant value, JsonSerializerOptions options)
105105
{
106106
JsonSerializer.Serialize(writer, value.Value, options);
107107
}

0 commit comments

Comments
 (0)