Skip to content

Commit 7cea030

Browse files
committed
fixed problems in java classes
1 parent 4293cc2 commit 7cea030

3 files changed

Lines changed: 17 additions & 10 deletions

File tree

quicktype.js

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -33,10 +33,10 @@ const MISSING_PARENT_CLASSES = [
3333
];
3434

3535
const PARENT_FIELDS = [
36-
{name: 'id', type: 'String'},
37-
{name: 'typ', type: 'Typ'},
38-
{name: 'version', type: 'String'},
39-
{name: 'zusatzAttribute', type: 'List<ZusatzAttribut>'}
36+
{name: '_id', type: 'String', final: false},
37+
{name: '_typ', type: 'Typ', final: true},
38+
{name: '_version', type: 'String', final: true},
39+
{name: 'zusatzAttribute', type: 'List<ZusatzAttribut>', final: false}
4040
];
4141

4242
const CUSTOM_JAVA_OPTIONS = {
@@ -463,7 +463,7 @@ function getClassFields(classBody) {
463463
*/
464464
function removeParentClassFields(fieldList) {
465465
const hasOwnVersionProperty = fieldList.slice(0, PARENT_FIELDS.length).findIndex(value => value.name === 'version') < 0;
466-
let fieldFilter = PARENT_FIELDS.map(value => value.name);
466+
let fieldFilter = PARENT_FIELDS.map(value => value.name.replace('_', ''));
467467
if (hasOwnVersionProperty) {
468468
fieldFilter = fieldFilter.filter(value => value !== 'version');
469469
}
@@ -612,7 +612,7 @@ function getImports(fieldList, fileData, fileMap, hasParent) {
612612
}
613613
if (hasParent) {
614614
for (const parentField of PARENT_FIELDS) {
615-
if (parentField.name !== 'typ' && parentField.name !== 'version') {
615+
if (!parentField.final) {
616616
addImports(parentField.type, fileMap, importList, classPath);
617617
}
618618
}
@@ -673,7 +673,7 @@ function getBuilderClass(classHead, fieldList, fileData, hasParent) {
673673
builderConstructor.push('}');
674674
if (hasParent) {
675675
for (const parentField of PARENT_FIELDS) {
676-
if (parentField.name !== 'typ' && parentField.name !== 'version') {
676+
if (!parentField.final) {
677677
builderMethods.push('');
678678
builderMethods.push(overwriteParentSetter(parentField, builderName));
679679
}

resource_schemas/COM.java

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,9 @@ protected COM(COMBuilder builder) {
2525
this.zusatzAttribute = builder.zusatzAttribute;
2626
}
2727

28+
protected COM() {
29+
}
30+
2831
/**
2932
* Hier können IDs anderer Systeme hinterlegt werden (z.B. eine SAP-GP-Nummer oder eine GUID)
3033
*/
@@ -58,9 +61,6 @@ public abstract static class COMBuilder {
5861
private String _id;
5962
private List<ZusatzAttribut> zusatzAttribute;
6063

61-
private COMBuilder() {
62-
}
63-
6464
/**
6565
* Hier können IDs anderer Systeme hinterlegt werden (z.B. eine SAP-GP-Nummer oder eine GUID)
6666
*/
@@ -73,5 +73,7 @@ public COMBuilder setZusatzAttribute(List<ZusatzAttribut> value) {
7373
this.zusatzAttribute = value;
7474
return this;
7575
}
76+
77+
public abstract COM build();
7678
}
7779
}

resource_schemas/Geschaeftsobjekt.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,9 @@ protected Geschaeftsobjekt(GeschaeftsobjektBuilder builder) {
2929
this.zusatzAttribute = builder.zusatzAttribute;
3030
}
3131

32+
protected Geschaeftsobjekt() {
33+
}
34+
3235
/**
3336
* Hier können IDs anderer Systeme hinterlegt werden (z.B. eine SAP-GP-Nummer oder eine GUID)
3437
*/
@@ -81,5 +84,7 @@ public GeschaeftsobjektBuilder setZusatzAttribute(List<ZusatzAttribut> value) {
8184
this.zusatzAttribute = value;
8285
return this;
8386
}
87+
88+
public abstract Geschaeftsobjekt build();
8489
}
8590
}

0 commit comments

Comments
 (0)