@@ -2,16 +2,18 @@ import * as _ from "lodash";
2
2
import { ConfigParseError } from "./configParseError" ;
3
3
import {
4
4
Assignment ,
5
+ BinaryOperator ,
5
6
BlankLine ,
6
- Block ,
7
7
BraceInitialiser ,
8
8
Declaration ,
9
9
Expression ,
10
10
FnCall ,
11
11
FnStatement ,
12
+ IfThenElse ,
12
13
Member ,
13
14
Method ,
14
15
Null ,
16
+ RangedFor ,
15
17
Return ,
16
18
Statement ,
17
19
StringConstant ,
@@ -190,8 +192,8 @@ export class Bean implements IBean {
190
192
this . _javaMembers . push ( new Method (
191
193
`public static ${ typeName } ${ this . getter } ()` ,
192
194
[
193
- new Block (
194
- `if ( ${ variableName } == null)` ,
195
+ new IfThenElse (
196
+ new BinaryOperator ( new Symbol ( variableName ) , "==" , new Null ( ) ) ,
195
197
[
196
198
new Assignment ( variableName , new FnCall ( creatorFn , constructorArgs ) ) ,
197
199
...initialisers ,
@@ -432,8 +434,10 @@ export class PropertiesValue extends Value {
432
434
"public static java.util.Properties listToProperties(java.util.List<java.util.AbstractMap.SimpleEntry<String, String>> properties)" ,
433
435
[
434
436
new Declaration ( "java.util.Properties" , "result" , new FnCall ( "new java.util.Properties" , [ ] ) ) ,
435
- new Block (
436
- "for (java.util.AbstractMap.SimpleEntry<String, String> prop : properties)" ,
437
+ new RangedFor (
438
+ "java.util.AbstractMap.SimpleEntry<String, String>" ,
439
+ "prop" ,
440
+ new Symbol ( "properties" ) ,
437
441
[
438
442
new FnStatement ( new FnCall ( "result.put" , [ new FnCall ( "prop.getKey" , [ ] ) , new FnCall ( "prop.getValue" , [ ] ) ] ) ) ,
439
443
] ) ,
@@ -481,8 +485,10 @@ export class MapValue extends Value {
481
485
"public static java.util.Map<String, String> listToMap(java.util.List<java.util.AbstractMap.SimpleEntry<String, String>> entries)" ,
482
486
[
483
487
new Declaration ( "java.util.Map<String, String>" , "result" , new FnCall ( "new java.util.HashMap<String, String>" , [ ] ) ) ,
484
- new Block (
485
- "for (java.util.AbstractMap.SimpleEntry<String, String> entry : entries)" ,
488
+ new RangedFor (
489
+ "java.util.AbstractMap.SimpleEntry<String, String>" ,
490
+ "entry" ,
491
+ new Symbol ( "entries" ) ,
486
492
[
487
493
new FnStatement ( new FnCall ( "result.put" , [ new FnCall ( "entry.getKey" , [ ] ) , new FnCall ( "entry.getValue" , [ ] ) ] ) ) ,
488
494
] ) ,
0 commit comments