@Mapping(source = "key.locationType", target = "basicLocation.locationTypeCode")
@Mapping(source = "detail.locationName", target = "basicLocation.locationName")
LocationRequest toRequest(CachedLocationKey key, CachedLocationDetail detail);
i am trying to map the object basicLocation
in LocationRequest. locationType
comes from key
and locationName
comes from detail
.
If i write both the mappings , there comes the below error :
@Mapping(source = "key.locationType", target = "basicLocation.locationTypeCode")
@Mapping(source = "detail.locationName", target = "basicLocation.locationName")
error:
java: No read accessor found for property "basicLocation" in target type.
On using either one of the mappings, it works fine.
@Mapping(source = "key.locationType", target = "basicLocation.locationTypeCode")
or
@Mapping(source = "detail.locationName", target = "basicLocation.locationName")
but i need to map both the fields to the basicLocation
object. am i missing something here ?