Use case
Switch Expressions added in JDK13 give a better way of writing switches.
Currently value mappings uses normal switches only.
Generated Code
Instead of generating:
switch ( b ) {
case "A": a = ValueMapper.A.A;
break;
case "B": a = ValueMapper.A.B;
break;
default: throw new IllegalArgumentException( "Unexpected enum constant: " + b );
}
the generated output could be
ValueMapper.A a = switch (b) {
case "A" -> A.A;
case "B" -> A.B;
default -> throw new IllegalArgumentException("Unexpected enum constant: " + b);
};
For enums constants the default branch is not needed.
Possible workarounds
No response
MapStruct Version
1.6.3
Use case
Switch Expressions added in JDK13 give a better way of writing switches.
Currently value mappings uses normal switches only.
Generated Code
Instead of generating:
the generated output could be
For enums constants the default branch is not needed.
Possible workarounds
No response
MapStruct Version
1.6.3