Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -158,9 +158,6 @@ void when_try_with_multiple_tasks_and_catch_except_when_with_uri_error_filter()
assertThat(catchDo).hasSize(1);
var ev = catchDo.get(0).getTask().getEmitTask().getEmit().getEvent().getWith();
assertThat(ev.getType()).isEqualTo("org.acme.recover");

// no retry configured here
assertThat(cat.getRetry().get()).isNull();
}

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -344,7 +344,7 @@ private void wrapIt(
String typeName = getTypeName(node, unionType, parentSchema);
JFieldVar instanceField =
getInstanceField(typeName, parentSchema, definedClass, unionType, node);
JMethod method = getSetterMethod(typeName, definedClass, instanceField, node);
JMethod method = getSetterMethod(typeName, definedClass, instanceField, node, valueField);
method
.body()
.assign(
Expand All @@ -369,12 +369,18 @@ private JVar setupMethod(
}

private JMethod getSetterMethod(
String fieldName, JDefinedClass definedClass, JFieldVar instanceField, JsonNode node) {
String fieldName,
JDefinedClass definedClass,
JFieldVar instanceField,
JsonNode node,
Optional<JFieldVar> valueField) {
String setterName = ruleFactory.getNameHelper().getSetterName(fieldName, node);
JMethod fluentMethod =
definedClass.method(JMod.PUBLIC, definedClass, setterName.replaceFirst("set", "with"));
JBlock body = fluentMethod.body();
body.assign(instanceField, fluentMethod.param(instanceField.type(), "value"));
JVar fluentMethodParam = fluentMethod.param(instanceField.type(), "value");
body.assign(instanceField, fluentMethodParam);
valueField.ifPresent(v -> fluentMethod.body().assign(JExpr._this().ref(v), fluentMethodParam));
body._return(JExpr._this());
return definedClass.method(JMod.PUBLIC, definedClass.owner().VOID, setterName);
}
Expand All @@ -393,7 +399,8 @@ private void wrapStrings(
String typeName = getTypeName(first.getNode(), first.getType(), parentSchema);
JFieldVar instanceField =
getInstanceField(typeName, parentSchema, definedClass, first.getType(), first.getNode());
JMethod setterMethod = getSetterMethod(typeName, definedClass, instanceField, first.getNode());
JMethod setterMethod =
getSetterMethod(typeName, definedClass, instanceField, first.getNode(), valueField);
JVar methodParam = setupMethod(definedClass, setterMethod, valueField, instanceField);
JBlock body = setterMethod.body();
if (pattern != null) {
Expand Down