Skip to content

Commit

Permalink
records
Browse files Browse the repository at this point in the history
  • Loading branch information
azahnen committed Jan 2, 2025
1 parent 6569161 commit 7dbe734
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions libxtracfg/js/types/java/data.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,9 @@ public ${name}(`;
}
if (Object.hasOwn(entry, "default")) {
code += `
this.${key} = Object.requireNonNullElse(${key},${getDefault(entry)});`;
this.${key} = java.util.Objects.requireNonNullElse(${key},${getDefault(
entry
)});`;
} else {
code += `
this.${key} = ${key};`;
Expand Down Expand Up @@ -113,7 +115,9 @@ public ${name}(`;
}
if (Object.hasOwn(entry, "default")) {
code += `
this.${key} = Object.requireNonNullElse(${key},${getDefault(entry)});`;
this.${key} = java.util.Objects.requireNonNullElse(${key},${getDefault(
entry
)});`;
} else {
code += `
this.${key} = ${key};`;
Expand All @@ -125,7 +129,7 @@ public ${name}(`;
`;
for (const [key, entry] of props) {
code += `
public ${getType(entry, suffixNs)} get${firstLetterUpperCase(key)}() {
public ${getType(entry, suffixNs)} ${key}() {
return ${key};
}
`;
Expand Down Expand Up @@ -174,7 +178,7 @@ public interface ${name} {
`;
for (const [key, entry] of Object.entries(properties)) {
code += `
${getType(entry, suffixNs)} get${firstLetterUpperCase(key)}();
${getType(entry, suffixNs)} ${key}();
`;
}

Expand Down

0 comments on commit 7dbe734

Please sign in to comment.