I'm using a recent version of MapStruct. I'm trying to map the values of the corresponding string values to the actual enum value.
For instance, this is my enum:
@Getter
@RequiredArgsConstructor
@Accessors(fluent = true)
public enum Type {
T1("SomeValue"),
T2("AnotherValue");
private final String label;
}
I have a Java type (ForeignType) with a field/member that receives the data (one of the string values in the enum): SomeValue or AnotherValue. Then I have a "controlled" type (MyType) and I would like to use in this one the actual enumeration constant (T1 or T2), based on string value sent.
I'm looking for a way to use MapStruct to do this, because the application currently uses it for all mapping purposes, but so far I can't find a way to achieve this.