Skip to content

Commit db6e04d

Browse files
committed
fixes
1 parent 07e4d4a commit db6e04d

File tree

2 files changed

+13
-6
lines changed

2 files changed

+13
-6
lines changed

src/com/mighty16/json/resolver/KotlinResolver.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ public String getModifier(boolean mutable) {
8282
@Override
8383
public String getFieldTypeAndValue(FieldModel field) {
8484
String type = field.optional ? field.type + "?" : field.type;
85-
return field.defaultValue != null ? type + " = " + field.defaultValue : type;
85+
return (field.defaultValue != null && field.defaultValue.length() > 0) ? type + " = " + field.defaultValue : type;
8686
}
8787

8888
@Override

src/com/mighty16/json/ui/ModelTableDialog.java

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
import javax.swing.border.EmptyBorder;
1212
import java.awt.event.*;
1313
import java.util.HashMap;
14+
import java.util.Iterator;
1415
import java.util.List;
1516

1617
public class ModelTableDialog extends JDialog implements ClassesListDelegate.OnClassSelectedListener {
@@ -60,7 +61,7 @@ public ModelTableDialog(List<ClassModel> data, LanguageResolver resolver, ModelT
6061
classesListDelegate = new ClassesListDelegate(table1, data, classNames, this);
6162
fieldsTableDelegate = new FieldsTableDelegate(fieldsTable, classNames, resolver);
6263
fieldsTableDelegate.setClass(data.get(0));
63-
claasesListLabel.setBorder(new EmptyBorder(0,0,10,0));
64+
claasesListLabel.setBorder(new EmptyBorder(0, 0, 10, 0));
6465
}
6566

6667
private void init() {
@@ -132,10 +133,16 @@ private void onOK() {
132133
if (className != null) {
133134
classModel.name = className;
134135
}
135-
for (FieldModel field : classModel.fields) {
136-
String fieldClassName = classNames.get(field.type);
137-
if (fieldClassName != null) {
138-
field.type = fieldClassName;
136+
Iterator<FieldModel> iterator = classModel.fields.iterator();
137+
while (iterator.hasNext()) {
138+
FieldModel field = iterator.next();
139+
if (!field.enabled) {
140+
iterator.remove();
141+
} else {
142+
String fieldClassName = classNames.get(field.type);
143+
if (fieldClassName != null) {
144+
field.type = fieldClassName;
145+
}
139146
}
140147
}
141148
}

0 commit comments

Comments
 (0)