-
-
Notifications
You must be signed in to change notification settings - Fork 1k
Closed
Description
Expected behavior
I would expect that when a condition only has @Context parameters that it is picked up and used if it is applicable
Actual behavior
The @Condition method is not picked
Steps to reproduce the problem
@Mapper
public interface TestMapper {
@Mapping(target = "value", conditionQualifiedByName = "shouldMapValue")
Target map(Source source);
@Condition
@Named("shouldMapValue")
default boolean shouldMapValue(@Context boolean shouldMapValue) {
return shouldMapValue;
}
class Target {
private final String value;
public Target(String value) {
this.value = value;
}
public String getValue() {
return value;
}
}
class Source {
private String value;
private boolean valueInitialized;
public String getValue() {
if (valueInitialized) {
return value;
}
throw new IllegalStateException("value is not initialized");
}
public void setValue(String value) {
this.valueInitialized = true;
this.value = value;
}
}
}MapStruct Version
1.5.5.Final