summaryrefslogtreecommitdiff
path: root/src/main
diff options
context:
space:
mode:
authorMichael Williamson <mike@zwobble.org>2026-07-05 11:03:07 +0100
committerMichael Williamson <mike@zwobble.org>2026-07-05 11:03:07 +0100
commit8ad682b242f84fc72499c9d0e1e7c4b0d585607e (patch)
treef9aa04036333c954ef7ae709f554268987b13b19 /src/main
parent786d039b6018e0cb0c97c0795af1b878cdfab332 (diff)
Include type name in encode/decode method names
Diffstat (limited to 'src/main')
-rw-r--r--src/main/java/org/zwobble/hobgoblin/compiler/output/generators/javatransient0/JavaTransient0Generator.java14
1 files changed, 10 insertions, 4 deletions
diff --git a/src/main/java/org/zwobble/hobgoblin/compiler/output/generators/javatransient0/JavaTransient0Generator.java b/src/main/java/org/zwobble/hobgoblin/compiler/output/generators/javatransient0/JavaTransient0Generator.java
index 0837855..ee35ebc 100644
--- a/src/main/java/org/zwobble/hobgoblin/compiler/output/generators/javatransient0/JavaTransient0Generator.java
+++ b/src/main/java/org/zwobble/hobgoblin/compiler/output/generators/javatransient0/JavaTransient0Generator.java
@@ -23,8 +23,6 @@ import java.util.stream.Stream;
public class JavaTransient0Generator implements Generator {
public static final String NAME = "java-transient-0";
- private static final JavaIdentifier ENCODE_METHOD_NAME = JavaIdentifier.of("encode");
- private static final JavaIdentifier DECODE_METHOD_NAME = JavaIdentifier.of("decode");
private static final JavaIdentifier VALUE_NAME = JavaIdentifier.of("value");
private static final JavaIdentifier OUTPUT_STREAM_NAME = JavaIdentifier.of("outputStream");
private static final JavaIdentifier INPUT_STREAM_NAME = JavaIdentifier.of("inputStream");
@@ -117,7 +115,7 @@ public class JavaTransient0Generator implements Generator {
yield Stream.of(
new JavaMethodDeclaration(
- ENCODE_METHOD_NAME,
+ encodeMethodName(structDefinition.type()),
JavaVisibility.PUBLIC,
JavaMethodKind.STATIC,
JavaTypeRef.VOID,
@@ -143,7 +141,7 @@ public class JavaTransient0Generator implements Generator {
)
),
new JavaMethodDeclaration(
- DECODE_METHOD_NAME,
+ decodeMethodName(structDefinition.type()),
JavaVisibility.PUBLIC,
JavaMethodKind.STATIC,
structJavaTypeRef,
@@ -300,6 +298,14 @@ public class JavaTransient0Generator implements Generator {
return statements.stream();
}
+ private JavaIdentifier encodeMethodName(StructType type) {
+ return this.javaGenerator.generateFieldName("encode" + type.name());
+ }
+
+ private JavaIdentifier decodeMethodName(StructType type) {
+ return this.javaGenerator.generateFieldName("decode" + type.name());
+ }
+
private static class Context {
private final TypesInfo typesInfo;