Skip to content

Commit

Permalink
feat[scala]: cut down scala protocol
Browse files Browse the repository at this point in the history
  • Loading branch information
jaysunxiao committed Jul 7, 2024
1 parent 829be32 commit cc6d6d3
Show file tree
Hide file tree
Showing 4 changed files with 180 additions and 45 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ public boolean writeObject(StringBuilder builder, String objectStr, Field field,
case Enhance:
builder.append(StringUtils.format("{}.writeBooleanArray($1, {});", EnhanceUtils.byteBufUtils, objectStr));
break;
case Kotlin, GdScript, Python:
case Kotlin, Scala, GdScript, Python:
builder.append(StringUtils.format("buffer.writeBooleanArray({})", objectStr)).append(LS);
break;
case Lua:
Expand All @@ -74,7 +74,7 @@ public boolean writeObject(StringBuilder builder, String objectStr, Field field,
case Enhance:
builder.append(StringUtils.format("{}.writeBooleanBoxArray($1, {});", EnhanceUtils.byteBufUtils, objectStr));
break;
case Kotlin, GdScript, Python:
case Kotlin, Scala, GdScript, Python:
builder.append(StringUtils.format("buffer.writeBooleanArray({})", objectStr)).append(LS);
break;
case Lua:
Expand All @@ -98,7 +98,7 @@ public boolean writeObject(StringBuilder builder, String objectStr, Field field,
case Enhance:
builder.append(StringUtils.format("{}.writeByteArray($1, {});", EnhanceUtils.byteBufUtils, objectStr));
break;
case Kotlin, GdScript, Python:
case Kotlin, Scala, GdScript, Python:
builder.append(StringUtils.format("buffer.writeByteArray({})", objectStr)).append(LS);
break;
case Lua:
Expand All @@ -122,7 +122,7 @@ public boolean writeObject(StringBuilder builder, String objectStr, Field field,
case Enhance:
builder.append(StringUtils.format("{}.writeByteBoxArray($1, {});", EnhanceUtils.byteBufUtils, objectStr));
break;
case Kotlin, GdScript, Python:
case Kotlin, Scala, GdScript, Python:
builder.append(StringUtils.format("buffer.writeByteArray({})", objectStr)).append(LS);
break;
case Lua:
Expand All @@ -146,7 +146,7 @@ public boolean writeObject(StringBuilder builder, String objectStr, Field field,
case Enhance:
builder.append(StringUtils.format("{}.writeShortArray($1, {});", EnhanceUtils.byteBufUtils, objectStr));
break;
case Kotlin, GdScript, Python:
case Kotlin, Scala, GdScript, Python:
builder.append(StringUtils.format("buffer.writeShortArray({})", objectStr)).append(LS);
break;
case Lua:
Expand All @@ -170,7 +170,7 @@ public boolean writeObject(StringBuilder builder, String objectStr, Field field,
case Enhance:
builder.append(StringUtils.format("{}.writeShortBoxArray($1, {});", EnhanceUtils.byteBufUtils, objectStr));
break;
case Kotlin, GdScript, Python:
case Kotlin, Scala, GdScript, Python:
builder.append(StringUtils.format("buffer.writeShortArray({})", objectStr)).append(LS);
break;
case Lua:
Expand All @@ -194,7 +194,7 @@ public boolean writeObject(StringBuilder builder, String objectStr, Field field,
case Enhance:
builder.append(StringUtils.format("{}.writeIntArray($1, {});", EnhanceUtils.byteBufUtils, objectStr));
break;
case Kotlin, GdScript, Python:
case Kotlin, Scala, GdScript, Python:
builder.append(StringUtils.format("buffer.writeIntArray({})", objectStr)).append(LS);
break;
case Lua:
Expand All @@ -218,7 +218,7 @@ public boolean writeObject(StringBuilder builder, String objectStr, Field field,
case Enhance:
builder.append(StringUtils.format("{}.writeIntBoxArray($1, {});", EnhanceUtils.byteBufUtils, objectStr));
break;
case Kotlin, GdScript, Python:
case Kotlin, Scala, GdScript, Python:
builder.append(StringUtils.format("buffer.writeIntArray({})", objectStr)).append(LS);
break;
case Lua:
Expand All @@ -242,7 +242,7 @@ public boolean writeObject(StringBuilder builder, String objectStr, Field field,
case Enhance:
builder.append(StringUtils.format("{}.writeLongArray($1, {});", EnhanceUtils.byteBufUtils, objectStr));
break;
case Kotlin, GdScript, Python:
case Kotlin, Scala, GdScript, Python:
builder.append(StringUtils.format("buffer.writeLongArray({})", objectStr)).append(LS);
break;
case Lua:
Expand All @@ -266,7 +266,7 @@ public boolean writeObject(StringBuilder builder, String objectStr, Field field,
case Enhance:
builder.append(StringUtils.format("{}.writeLongBoxArray($1, {});", EnhanceUtils.byteBufUtils, objectStr));
break;
case Kotlin, GdScript, Python:
case Kotlin, Scala, GdScript, Python:
builder.append(StringUtils.format("buffer.writeLongArray({})", objectStr)).append(LS);
break;
case Lua:
Expand All @@ -290,7 +290,7 @@ public boolean writeObject(StringBuilder builder, String objectStr, Field field,
case Enhance:
builder.append(StringUtils.format("{}.writeFloatArray($1, {});", EnhanceUtils.byteBufUtils, objectStr));
break;
case Kotlin, GdScript, Python:
case Kotlin, Scala, GdScript, Python:
builder.append(StringUtils.format("buffer.writeFloatArray({})", objectStr)).append(LS);
break;
case Lua:
Expand All @@ -314,7 +314,7 @@ public boolean writeObject(StringBuilder builder, String objectStr, Field field,
case Enhance:
builder.append(StringUtils.format("{}.writeFloatBoxArray($1, {});", EnhanceUtils.byteBufUtils, objectStr));
break;
case Kotlin, GdScript, Python:
case Kotlin, Scala, GdScript, Python:
builder.append(StringUtils.format("buffer.writeFloatArray({})", objectStr)).append(LS);
break;
case Lua:
Expand All @@ -338,7 +338,7 @@ public boolean writeObject(StringBuilder builder, String objectStr, Field field,
case Enhance:
builder.append(StringUtils.format("{}.writeDoubleArray($1, {});", EnhanceUtils.byteBufUtils, objectStr));
break;
case Kotlin, GdScript, Python:
case Kotlin, Scala, GdScript, Python:
builder.append(StringUtils.format("buffer.writeDoubleArray({})", objectStr)).append(LS);
break;
case Lua:
Expand All @@ -362,7 +362,7 @@ public boolean writeObject(StringBuilder builder, String objectStr, Field field,
case Enhance:
builder.append(StringUtils.format("{}.writeDoubleBoxArray($1, {});", EnhanceUtils.byteBufUtils, objectStr));
break;
case Kotlin, GdScript, Python:
case Kotlin, Scala, GdScript, Python:
builder.append(StringUtils.format("buffer.writeDoubleArray({})", objectStr)).append(LS);
break;
case Lua:
Expand All @@ -386,7 +386,7 @@ public boolean writeObject(StringBuilder builder, String objectStr, Field field,
case Enhance:
builder.append(StringUtils.format("{}.writeStringArray($1, {});", EnhanceUtils.byteBufUtils, objectStr));
break;
case Kotlin, GdScript, Python:
case Kotlin, Scala, GdScript, Python:
builder.append(StringUtils.format("buffer.writeStringArray({})", objectStr)).append(LS);
break;
case Lua:
Expand Down Expand Up @@ -479,6 +479,9 @@ public String readObject(StringBuilder builder, Field field, IFieldRegistration
case Kotlin:
builder.append(StringUtils.format("val {} = buffer.readBooleanArray()", array)).append(LS);
break;
case Scala:
builder.append(StringUtils.format("val {} = buffer.readBooleanArray", array)).append(LS);
break;
case JavaScript, EcmaScript, TypeScript:
builder.append(StringUtils.format("const {} = buffer.readBooleanArray();", array)).append(LS);
break;
Expand Down Expand Up @@ -512,6 +515,9 @@ public String readObject(StringBuilder builder, Field field, IFieldRegistration
case Kotlin:
builder.append(StringUtils.format("val {} = buffer.readBooleanArray()", array)).append(LS);
break;
case Scala:
builder.append(StringUtils.format("val {} = buffer.readBooleanArray", array)).append(LS);
break;
case JavaScript, EcmaScript, TypeScript:
builder.append(StringUtils.format("const {} = buffer.readBooleanArray();", array)).append(LS);
break;
Expand Down Expand Up @@ -548,6 +554,9 @@ public String readObject(StringBuilder builder, Field field, IFieldRegistration
case Kotlin:
builder.append(StringUtils.format("val {} = buffer.readByteArray()", array)).append(LS);
break;
case Scala:
builder.append(StringUtils.format("val {} = buffer.readByteArray", array)).append(LS);
break;
case JavaScript, EcmaScript, TypeScript:
builder.append(StringUtils.format("const {} = buffer.readByteArray();", array)).append(LS);
break;
Expand Down Expand Up @@ -581,6 +590,9 @@ public String readObject(StringBuilder builder, Field field, IFieldRegistration
case Kotlin:
builder.append(StringUtils.format("val {} = buffer.readByteArray()", array)).append(LS);
break;
case Scala:
builder.append(StringUtils.format("val {} = buffer.readByteArray", array)).append(LS);
break;
case JavaScript, EcmaScript, TypeScript:
builder.append(StringUtils.format("const {} = buffer.readByteArray();", array)).append(LS);
break;
Expand Down Expand Up @@ -617,6 +629,9 @@ public String readObject(StringBuilder builder, Field field, IFieldRegistration
case Kotlin:
builder.append(StringUtils.format("val {} = buffer.readShortArray()", array)).append(LS);
break;
case Scala:
builder.append(StringUtils.format("val {} = buffer.readShortArray", array)).append(LS);
break;
case JavaScript, EcmaScript, TypeScript:
builder.append(StringUtils.format("const {} = buffer.readShortArray();", array)).append(LS);
break;
Expand Down Expand Up @@ -650,6 +665,9 @@ public String readObject(StringBuilder builder, Field field, IFieldRegistration
case Kotlin:
builder.append(StringUtils.format("val {} = buffer.readShortArray()", array)).append(LS);
break;
case Scala:
builder.append(StringUtils.format("val {} = buffer.readShortArray", array)).append(LS);
break;
case JavaScript, EcmaScript, TypeScript:
builder.append(StringUtils.format("const {} = buffer.readShortArray();", array)).append(LS);
break;
Expand Down Expand Up @@ -686,6 +704,9 @@ public String readObject(StringBuilder builder, Field field, IFieldRegistration
case Kotlin:
builder.append(StringUtils.format("val {} = buffer.readIntArray()", array)).append(LS);
break;
case Scala:
builder.append(StringUtils.format("val {} = buffer.readIntArray", array)).append(LS);
break;
case JavaScript, EcmaScript, TypeScript:
builder.append(StringUtils.format("const {} = buffer.readIntArray();", array)).append(LS);
break;
Expand Down Expand Up @@ -719,6 +740,9 @@ public String readObject(StringBuilder builder, Field field, IFieldRegistration
case Kotlin:
builder.append(StringUtils.format("val {} = buffer.readIntArray()", array)).append(LS);
break;
case Scala:
builder.append(StringUtils.format("val {} = buffer.readIntArray", array)).append(LS);
break;
case JavaScript, EcmaScript, TypeScript:
builder.append(StringUtils.format("const {} = buffer.readIntArray();", array)).append(LS);
break;
Expand Down Expand Up @@ -755,6 +779,9 @@ public String readObject(StringBuilder builder, Field field, IFieldRegistration
case Kotlin:
builder.append(StringUtils.format("val {} = buffer.readLongArray()", array)).append(LS);
break;
case Scala:
builder.append(StringUtils.format("val {} = buffer.readLongArray", array)).append(LS);
break;
case JavaScript, EcmaScript, TypeScript:
builder.append(StringUtils.format("const {} = buffer.readLongArray();", array)).append(LS);
break;
Expand Down Expand Up @@ -788,6 +815,9 @@ public String readObject(StringBuilder builder, Field field, IFieldRegistration
case Kotlin:
builder.append(StringUtils.format("val {} = buffer.readLongArray()", array)).append(LS);
break;
case Scala:
builder.append(StringUtils.format("val {} = buffer.readLongArray", array)).append(LS);
break;
case JavaScript, EcmaScript, TypeScript:
builder.append(StringUtils.format("const {} = buffer.readLongArray();", array)).append(LS);
break;
Expand Down Expand Up @@ -824,6 +854,9 @@ public String readObject(StringBuilder builder, Field field, IFieldRegistration
case Kotlin:
builder.append(StringUtils.format("val {} = buffer.readFloatArray()", array)).append(LS);
break;
case Scala:
builder.append(StringUtils.format("val {} = buffer.readFloatArray", array)).append(LS);
break;
case JavaScript, EcmaScript, TypeScript:
builder.append(StringUtils.format("const {} = buffer.readFloatArray();", array)).append(LS);
break;
Expand Down Expand Up @@ -857,6 +890,9 @@ public String readObject(StringBuilder builder, Field field, IFieldRegistration
case Kotlin:
builder.append(StringUtils.format("val {} = buffer.readFloatArray()", array)).append(LS);
break;
case Scala:
builder.append(StringUtils.format("val {} = buffer.readFloatArray", array)).append(LS);
break;
case JavaScript, EcmaScript, TypeScript:
builder.append(StringUtils.format("const {} = buffer.readFloatArray();", array)).append(LS);
break;
Expand Down Expand Up @@ -893,6 +929,9 @@ public String readObject(StringBuilder builder, Field field, IFieldRegistration
case Kotlin:
builder.append(StringUtils.format("val {} = buffer.readDoubleArray()", array)).append(LS);
break;
case Scala:
builder.append(StringUtils.format("val {} = buffer.readDoubleArray", array)).append(LS);
break;
case JavaScript, EcmaScript, TypeScript:
builder.append(StringUtils.format("const {} = buffer.readDoubleArray();", array)).append(LS);
break;
Expand Down Expand Up @@ -926,6 +965,9 @@ public String readObject(StringBuilder builder, Field field, IFieldRegistration
case Kotlin:
builder.append(StringUtils.format("val {} = buffer.readDoubleArray()", array)).append(LS);
break;
case Scala:
builder.append(StringUtils.format("val {} = buffer.readDoubleArray", array)).append(LS);
break;
case JavaScript, EcmaScript, TypeScript:
builder.append(StringUtils.format("const {} = buffer.readDoubleArray();", array)).append(LS);
break;
Expand Down Expand Up @@ -962,6 +1004,9 @@ public String readObject(StringBuilder builder, Field field, IFieldRegistration
case Kotlin:
builder.append(StringUtils.format("val {} = buffer.readStringArray()", array)).append(LS);
break;
case Scala:
builder.append(StringUtils.format("val {} = buffer.readStringArray", array)).append(LS);
break;
case JavaScript, EcmaScript, TypeScript:
builder.append(StringUtils.format("const {} = buffer.readStringArray();", array)).append(LS);
break;
Expand Down
Loading

0 comments on commit cc6d6d3

Please sign in to comment.