From fd83a2a870d7c37e752638a1f2cfb8fd4a9125ba Mon Sep 17 00:00:00 2001 From: Andreas Zahnen Date: Thu, 2 Jan 2025 18:26:27 +0100 Subject: [PATCH] records --- libxtracfg/js/types/generate-java-classes.ts | 3 ++- libxtracfg/js/types/src/index.ts | 4 ++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/libxtracfg/js/types/generate-java-classes.ts b/libxtracfg/js/types/generate-java-classes.ts index d83fb95..f6f7675 100644 --- a/libxtracfg/js/types/generate-java-classes.ts +++ b/libxtracfg/js/types/generate-java-classes.ts @@ -6,6 +6,7 @@ import { generateClass, generateJava } from "./java/index.ts"; const dataNs = ["Command", "Options", "Result"]; const suffixNs = ["Command", "Options"]; const commandNs = "Command"; +const baseOptions = "BaseOptions"; const baseResult = "BaseResult"; const failureResult = "FailureResult"; @@ -129,7 +130,7 @@ public abstract class Handler {}); + ${result} result = handle(new ${initCommand}((${baseOptions})command.options()), false, ignore -> {}); if (result instanceof ${failure}) { return result; diff --git a/libxtracfg/js/types/src/index.ts b/libxtracfg/js/types/src/index.ts index 157e12e..2de852f 100644 --- a/libxtracfg/js/types/src/index.ts +++ b/libxtracfg/js/types/src/index.ts @@ -69,9 +69,9 @@ export namespace Command { //TODO: should be abstract so that it cannot be instantiated, but that breaks the JSON schema generation export class Base { readonly command: Enums.Main; - readonly options: Options.Base; + readonly options: Options.Options; - constructor(command: Enums.Main, options: Options.Base) { + constructor(command: Enums.Main, options: Options.Options) { this.command = command; this.options = options; }