summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Williamson <mike@zwobble.org>2026-06-12 16:24:15 +0100
committerMichael Williamson <mike@zwobble.org>2026-06-12 16:24:15 +0100
commit29aa98cc55e489112aa872948a9ad738955e410e (patch)
treee6473d176c5be80b25bd9bef0276df8620455990
parent9308b348a4462b3d96f188881660d4d40ebc0da8 (diff)
Generate static constructor method
-rw-r--r--src/main/java/org/zwobble/hobgoblin/compiler/output/generators/javapreciselymatchers/JavaPreciselyMatchersGenerator.java17
1 files changed, 17 insertions, 0 deletions
diff --git a/src/main/java/org/zwobble/hobgoblin/compiler/output/generators/javapreciselymatchers/JavaPreciselyMatchersGenerator.java b/src/main/java/org/zwobble/hobgoblin/compiler/output/generators/javapreciselymatchers/JavaPreciselyMatchersGenerator.java
index 6849387..b304d5a 100644
--- a/src/main/java/org/zwobble/hobgoblin/compiler/output/generators/javapreciselymatchers/JavaPreciselyMatchersGenerator.java
+++ b/src/main/java/org/zwobble/hobgoblin/compiler/output/generators/javapreciselymatchers/JavaPreciselyMatchersGenerator.java
@@ -18,6 +18,8 @@ import java.nio.file.Path;
import java.util.ArrayList;
import java.util.List;
+import static org.zwobble.hobgoblin.compiler.util.Casing.lowerCamelCaseToUpperCamelCase;
+
public class JavaPreciselyMatchersGenerator implements Generator {
public static final String NAME = "java-precisely-matchers";
@@ -104,6 +106,21 @@ public class JavaPreciselyMatchersGenerator implements Generator {
)
),
List.of(
+ new JavaMethodDeclaration(
+ "is" + lowerCamelCaseToUpperCamelCase(structDefinition.name()),
+ JavaVisibility.PUBLIC,
+ JavaMethodKind.STATIC,
+ javaMatcherTypeRef,
+ List.of(),
+ new JavaBlock(List.of(
+ new JavaReturn(new JavaNewExpression(
+ javaMatcherTypeRef,
+ List.of(
+ new JavaStaticMethodCall(JavaTypeRef.LIST, "of", List.of())
+ )
+ ))
+ ))
+ ),
new JavaConstructorDeclaration(
matcherTypeName,
JavaVisibility.PRIVATE,