@@ -439,14 +439,22 @@ public BodyDeclaration<?> toMethodDeclaration() {
439439 String .format (
440440 "return new Event<>(\" %s.%s\" , ConverterFunctions.empty());" ,
441441 domain .name , name ));
442- } else if (type instanceof ObjectType || type instanceof ArrayType ) {
442+ } else if (type instanceof ObjectType ) {
443443 methodDecl
444444 .getBody ()
445445 .get ()
446446 .addStatement (
447447 String .format (
448448 "return new Event<>(\" %s.%s\" , input -> %s);" ,
449449 domain .name , name , type .getMapper ()));
450+ } else if (type instanceof ArrayType ) {
451+ methodDecl
452+ .getBody ()
453+ .get ()
454+ .addStatement (
455+ String .format (
456+ "return new Event<>(\" %s.%s\" , ConverterFunctions.map(\" %s\" , input -> %s));" ,
457+ domain .name , name , type .getName (), type .getMapper ()));
450458 } else {
451459 methodDecl
452460 .getBody ()
@@ -660,11 +668,17 @@ public MethodDeclaration toMethodDeclaration() {
660668 body .addStatement (
661669 String .format (
662670 "return new Command<>(\" %s.%s\" , Map.copyOf(params));" , domain .name , name ));
663- } else if (type instanceof ObjectType || type instanceof ArrayType ) {
671+ } else if (type instanceof ObjectType ) {
664672 body .addStatement (
665673 String .format (
666674 "return new Command<>(\" %s.%s\" , Map.copyOf(params), input -> %s);" ,
667675 domain .name , name , type .getMapper ()));
676+ } else if (type instanceof ArrayType ) {
677+ body .addStatement (
678+ String .format (
679+ "return new Command<>(\" %s.%s\" , Map.copyOf(params), ConverterFunctions.map(\" %s\" ,"
680+ + " input -> %s));" ,
681+ domain .name , name , type .getName (), type .getMapper ()));
668682 } else {
669683 body .addStatement (
670684 String .format (
0 commit comments