This is my Mapper:
@Mapper
public interface ProductMapper {
ProductClassification toProductClassification(ProductTypes pisType);
}
Where ProductTypes and ProductClassification are enums. I want it to throw an exception when it can't map the enums, but I get compiler error:
The following constants from the source enum have no corresponding constant in the target enum and must be be mapped via adding additional mappings: EXTERNAL, UNKNOWN.
I tried with @ValueMappings annotation, but can only configure it to set the value to null, which is not sufficient:
@ValueMappings({
@ValueMapping(source = MappingConstants.ANY_REMAINING, target = MappingConstants.NULL)
})
What would be the right way to configure MapStruct mapper to throw an exception when it can't map enum constants?