@@ -2,16 +2,18 @@ import * as _ from "lodash";
22import { ConfigParseError } from "./configParseError" ;
33import {
44 Assignment ,
5+ BinaryOperator ,
56 BlankLine ,
6- Block ,
77 BraceInitialiser ,
88 Declaration ,
99 Expression ,
1010 FnCall ,
1111 FnStatement ,
12+ IfThenElse ,
1213 Member ,
1314 Method ,
1415 Null ,
16+ RangedFor ,
1517 Return ,
1618 Statement ,
1719 StringConstant ,
@@ -190,8 +192,8 @@ export class Bean implements IBean {
190192 this . _javaMembers . push ( new Method (
191193 `public static ${ typeName } ${ this . getter } ()` ,
192194 [
193- new Block (
194- `if ( ${ variableName } == null)` ,
195+ new IfThenElse (
196+ new BinaryOperator ( new Symbol ( variableName ) , "==" , new Null ( ) ) ,
195197 [
196198 new Assignment ( variableName , new FnCall ( creatorFn , constructorArgs ) ) ,
197199 ...initialisers ,
@@ -432,8 +434,10 @@ export class PropertiesValue extends Value {
432434 "public static java.util.Properties listToProperties(java.util.List<java.util.AbstractMap.SimpleEntry<String, String>> properties)" ,
433435 [
434436 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" ) ,
437441 [
438442 new FnStatement ( new FnCall ( "result.put" , [ new FnCall ( "prop.getKey" , [ ] ) , new FnCall ( "prop.getValue" , [ ] ) ] ) ) ,
439443 ] ) ,
@@ -481,8 +485,10 @@ export class MapValue extends Value {
481485 "public static java.util.Map<String, String> listToMap(java.util.List<java.util.AbstractMap.SimpleEntry<String, String>> entries)" ,
482486 [
483487 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" ) ,
486492 [
487493 new FnStatement ( new FnCall ( "result.put" , [ new FnCall ( "entry.getKey" , [ ] ) , new FnCall ( "entry.getValue" , [ ] ) ] ) ) ,
488494 ] ) ,
0 commit comments