问题
I want to use Lombook framework and to extend the Java Class that I map. Currently I use this:
// @Mapper(config = BaseMapperConfig.class)
public interface MerchantsMapper {
MerchantNewDTO toNewDTO(Merchants merchant);
}
Custom implementation:
public MerchantNewDTO toNewDTO(Merchants merchant)
{
MerchantNewDTO merchantNewDTO = new MerchantNewDTO();
merchantNewDTO.setId(Integer.valueOf(merchant.getId()));
......
MerchantConfigurationUtils merchant_config = new MerchantConfigurationUtils();
Map<MerchantConfigurationFeatureBitString, Boolean> features = merchant_config.initFromDatabaseValue(merchant.getSupported_features());
merchantNewDTO.setSupports_api(features.get(MerchantConfigurationFeatureBitString.Supports_api));
return merchantNewDTO;
}
As you can see I want to get getSupported_features and to populate the Supports_api value.
But it's very painful process to add new values. Is there some way to create adapter which extends the mapped interface and set/get the values?
来源:https://stackoverflow.com/questions/57384982/implement-params-convert-after-lombok-mapping